utils.js
This file
Path
test/utils.js
70 lines · 2.1 KiB · JavaScript
Last changed by
fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359
History of this fileTake it
The walk stopped after 200 commits: lines older than 2a0c35a point at it.
Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
line 1why, one step back1'use strict'Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
line 2why, one step back2fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359
line 3why, one step back3var assert = require('node:assert');Merge tag '4.12.0'Douglas Christopher Wilsonbefore adoptionf6ec710
line 4why, one step back4var utils = require('../lib/utils');Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 5–7why, one step back56describe('utils.etag(body, encoding)', function(){7 it('should support strings', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 8–9why, one step back8 assert.strictEqual(utils.etag('express!'),9 '"8-O2uVAFaQ1rZvlKLT14RnuvjPIdg"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 10–12why, one step back10 })1112 it('should support utf8 strings', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 13–14why, one step back13 assert.strictEqual(utils.etag('express❤', 'utf8'),14 '"a-JBiXf7GyzxwcrxY4hVXUwa7tmks"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 15–17why, one step back15 })1617 it('should support buffer', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 18–19why, one step back18 assert.strictEqual(utils.etag(Buffer.from('express!')),19 '"8-O2uVAFaQ1rZvlKLT14RnuvjPIdg"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 20–22why, one step back20 })2122 it('should support empty string', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 23–24why, one step back23 assert.strictEqual(utils.etag(''),24 '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 25–26why, one step back25 })26})Merge tag '4.12.0'Douglas Christopher Wilsonbefore adoptionf6ec710
lines 27–48why, one step back2728describe('utils.setCharset(type, charset)', function () {29 it('should do anything without type', function () {30 assert.strictEqual(utils.setCharset(), undefined);31 });3233 it('should return type if not given charset', function () {34 assert.strictEqual(utils.setCharset('text/html'), 'text/html');35 });3637 it('should keep charset if not given charset', function () {38 assert.strictEqual(utils.setCharset('text/html; charset=utf-8'), 'text/html; charset=utf-8');39 });4041 it('should set charset', function () {42 assert.strictEqual(utils.setCharset('text/html', 'utf-8'), 'text/html; charset=utf-8');43 });4445 it('should override charset', function () {46 assert.strictEqual(utils.setCharset('text/html; charset=iso-8859-1', 'utf-8'), 'text/html; charset=utf-8');47 });48});Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 49–51why, one step back4950describe('utils.wetag(body, encoding)', function(){51 it('should support strings', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 52–53why, one step back52 assert.strictEqual(utils.wetag('express!'),53 'W/"8-O2uVAFaQ1rZvlKLT14RnuvjPIdg"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 54–56why, one step back54 })5556 it('should support utf8 strings', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 57–58why, one step back57 assert.strictEqual(utils.wetag('express❤', 'utf8'),58 'W/"a-JBiXf7GyzxwcrxY4hVXUwa7tmks"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 59–61why, one step back59 })6061 it('should support buffer', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 62–63why, one step back62 assert.strictEqual(utils.wetag(Buffer.from('express!')),63 'W/"8-O2uVAFaQ1rZvlKLT14RnuvjPIdg"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 64–66why, one step back64 })6566 it('should support empty string', function(){Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 67–68why, one step back67 assert.strictEqual(utils.wetag(''),68 'W/"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"')Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a
lines 69–70why, one step back69 })70})