Skip to content

Commit 9fa7eba

Browse files
committed
improve test case to check correct data
1 parent c854e30 commit 9fa7eba

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @type {import("../../../../").RawLoaderDefinition<{ size: string }>} */
22
module.exports = function () {
33
const options = this.getOptions();
4-
return Buffer.alloc(+options.size);
4+
return Buffer.alloc(+options.size).fill(0xa5);
55
};
66
module.exports.raw = true;

test/cases/large/big-assets/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
const createHash = require("../../../../lib/util/hash/xxhash64");
2+
const fs = require("fs");
3+
4+
const h = url => {
5+
const hash = createHash();
6+
hash.update(fs.readFileSync(url));
7+
return hash.digest("hex");
8+
};
9+
110
it("should compile fine", () => {
211
const a = new URL(
312
"./generate-big-asset-loader.js?size=100000000!",
@@ -23,4 +32,10 @@ it("should compile fine", () => {
2332
"./generate-big-asset-loader.js?size=600000000!",
2433
import.meta.url
2534
);
35+
expect(h(a)).toBe("a7540f59366bb641");
36+
expect(h(b)).toBe("f642344242fa9de4");
37+
expect(h(c)).toBe("255d2b78f94dd585");
38+
expect(h(d)).toBe("c75503096358dd24");
39+
expect(h(e)).toBe("33ba203498301384");
40+
expect(h(f)).toBe("e71a39b9b1138c07");
2641
});

0 commit comments

Comments
 (0)