@typed/content-hash
Version:
Content hash a directory of HTML/JS/CSS files and other static assets
47 lines • 1.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = require("assert");
const parseSrcSets_1 = require("./parseSrcSets");
describe('parseSrcSets', () => {
describe('given a srcSet', () => {
it('returns a parsed variant', () => {
const srcSet = `/wp-content/uploads/flamingo4x.jpg 4025w,
/wp-content/uploads/flamingo3x.jpg 3019w,
/wp-content/uploads/flamingo2x.jpg 2013w,
/wp-content/uploads/flamingo1x.jpg 1006w`;
const offset = 100;
const images = (0, parseSrcSets_1.parseSrcSets)(srcSet, offset);
(0, assert_1.deepStrictEqual)(images, [
{
url: '/wp-content/uploads/flamingo4x.jpg',
position: {
start: offset + 0,
end: offset + 34,
},
},
{
url: '/wp-content/uploads/flamingo3x.jpg',
position: {
start: offset + 44,
end: offset + 78,
},
},
{
url: '/wp-content/uploads/flamingo2x.jpg',
position: {
start: offset + 88,
end: offset + 122,
},
},
{
url: '/wp-content/uploads/flamingo1x.jpg',
position: {
start: offset + 132,
end: offset + 166,
},
},
]);
});
});
});
//# sourceMappingURL=parseSrcSets.test.js.map