Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,29 @@
'W/"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"')
})
})

describe('utils.compileETag()', function () {
it('should return generateETag for true', function () {
const fn = utils.compileETag(true);

Check failure on line 86 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 4 spaces but found 2
assert.strictEqual(typeof fn, 'function');

Check failure on line 87 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 4 spaces but found 2
});

Check failure on line 89 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
it('should return undefined for false', function () {
assert.strictEqual(utils.compileETag(false), undefined);

Check failure on line 91 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 4 spaces but found 2
});

Check failure on line 93 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
it('should return generateETag for string values "strong" and "weak"', function () {
assert.strictEqual(typeof utils.compileETag('strong'), 'function');

Check failure on line 95 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 4 spaces but found 2
assert.strictEqual(typeof utils.compileETag('weak'), 'function');

Check failure on line 96 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 4 spaces but found 2
});

Check failure on line 98 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
it('should throw for unknown string values', function () {
assert.throws(() => utils.compileETag('foo'), TypeError);

Check failure on line 100 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 4 spaces but found 2
});

Check failure on line 102 in test/utils.js

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
it('should throw for unsupported types like arrays and objects', function () {
assert.throws(() => utils.compileETag([]), TypeError);
assert.throws(() => utils.compileETag({}), TypeError);
});

});