forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebpackMissingModule.test.js
28 lines (24 loc) · 1.23 KB
/
WebpackMissingModule.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* globals describe, it */
"use strict";
const should = require("should");
const WebpackMissingModule = require("../lib/dependencies/WebpackMissingModule");
describe("WebpackMissingModule", () => {
describe("#moduleCode", () => {
it("returns an error message based on given error message", () => {
const errorMessage = WebpackMissingModule.moduleCode("mock message");
should(errorMessage).be.eql("var e = new Error(\"Cannot find module \\\"mock message\\\"\"); e.code = \'MODULE_NOT_FOUND\'; throw e;");
});
});
describe("#promise", () => {
it("returns an error message based on given error message", () => {
const errorMessage = WebpackMissingModule.promise("mock message");
should(errorMessage).be.eql("Promise.reject(function webpackMissingModule() { var e = new Error(\"Cannot find module \\\"mock message\\\"\"); e.code = 'MODULE_NOT_FOUND';; return e; }())");
});
});
describe("#module", () => {
it("returns an error message based on given error message", () => {
const errorMessage = WebpackMissingModule.module("mock message");
should(errorMessage).be.eql("!(function webpackMissingModule() { var e = new Error(\"Cannot find module \\\"mock message\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())");
});
});
});