2016-01-07 02:56:17 +08:00
|
|
|
it("should replace a context with a manual map", function() {
|
|
|
|
function rqInContext(x) {
|
|
|
|
return require(x);
|
|
|
|
}
|
2018-01-27 05:51:03 +08:00
|
|
|
expect(rqInContext("a")).toBe("a");
|
|
|
|
expect(rqInContext("b")).toBe("b");
|
|
|
|
expect(rqInContext("./c")).toBe("b");
|
|
|
|
expect(rqInContext("d")).toBe("d");
|
|
|
|
expect(rqInContext("./d")).toBe("d");
|
2018-01-27 06:59:38 +08:00
|
|
|
(expect(function() {
|
2016-01-07 02:56:17 +08:00
|
|
|
rqInContext("module-b")
|
2018-01-27 06:59:38 +08:00
|
|
|
}).toThrowError());
|
2016-01-07 02:56:17 +08:00
|
|
|
});
|