-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
52 lines (41 loc) · 1.04 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const test = require("tape");
const withSourceMaps = require("@zeit/next-source-maps");
const withAwesomeTypescript = require("./index");
const mockWebpackConfig = {
module: {
rules: [],
},
resolve: {
extensions: [],
},
plugins: [],
};
const mockOptions = {
dir: "",
defaultLoaders: { babel: { options: {} } },
dev: false,
isServer: false,
};
test("Check for success when called without arguments", t => {
t.plan(1);
const nextConfig = withAwesomeTypescript();
nextConfig.webpack(mockWebpackConfig, mockOptions);
t.pass();
});
test("Check for success when called with withSourceMaps", t => {
t.plan(1);
const nextConfig = withAwesomeTypescript(withSourceMaps());
nextConfig.webpack(mockWebpackConfig, mockOptions);
t.pass();
});
test("Check for success when called with custom config", t => {
t.plan(1);
const nextConfig = withAwesomeTypescript({
assetPrefix: "testprefix",
webpack(config, options) {
return config;
},
});
nextConfig.webpack(mockWebpackConfig, mockOptions);
t.pass();
});