Skip to content

Commit 016ec7b

Browse files
authored
Merge pull request #15010 from webpack/test/large-cache-file
improve test case to check correct data
2 parents 5929bfc + 9fa7eba commit 016ec7b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy