Skip to content

Commit 5cb7bfa

Browse files
committed
add test case for DelegatedModule#updateHash
this test case verifies that webpack#5684 is fixed
1 parent a0ddd55 commit 5cb7bfa

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/DelegatedModule.test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* globals describe, it, beforeEach */
2+
"use strict";
3+
require("should");
4+
const DelegatedModule = require("../lib/DelegatedModule");
5+
6+
describe("DelegatedModule", function() {
7+
describe("#updateHash", function() {
8+
const sourceRequest = "dll-reference dll_e54c0fb67f8152792ad2";
9+
const data = {
10+
id: "/xg9"
11+
};
12+
const type = "require";
13+
const userRequest = "./library.js";
14+
let hashedText;
15+
let hash;
16+
beforeEach(function() {
17+
hashedText = "";
18+
hash = {
19+
update: (text) => {
20+
hashedText += text;
21+
}
22+
};
23+
const delegatedModule = new DelegatedModule(sourceRequest, data, type, userRequest);
24+
delegatedModule.updateHash(hash);
25+
});
26+
it("calls hash function with delegated module ID", function() {
27+
hashedText.should.containEql("/xg9");
28+
});
29+
});
30+
});

0 commit comments

Comments
 (0)