Skip to content

Commit c252c01

Browse files
Ben LmscBen Lmsc
authored andcommitted
test: add netlifyConfig prop
1 parent 6043e34 commit c252c01

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/index.test.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
const {onPreBuild} = require("./../index");
22

3+
const netlifyConfig = {
4+
build: {
5+
environment: {},
6+
},
7+
};
8+
39
const utils = {
410
run : {
511
command() {},
@@ -18,8 +24,11 @@ const utils = {
1824
},
1925
};
2026
const addProcessEnv = (...envVars) => { envVars.forEach(envVar => process.env[envVar] = `Test for ${envVar}`); };
21-
const preCallback = (prefix, def) => onPreBuild({inputs: {prefix, def}, utils});
27+
const preCallback = (prefix, def) => onPreBuild({inputs: {prefix, def}, utils, netlifyConfig});
2228

29+
beforeEach(() => {
30+
netlifyConfig.build.environment = {};
31+
});
2332

2433
test("normal configuration", () => {
2534
// Prepares data
@@ -36,7 +45,7 @@ test("normal configuration", () => {
3645

3746
// Multi checks
3847
def.forEach(varName => (
39-
expect(process.env).toHaveProperty(`${prefix}_${varName}`, process.env[varName])
48+
expect(netlifyConfig.build.environment).toHaveProperty(`${prefix}_${varName}`, process.env[varName])
4049
));
4150
});
4251

0 commit comments

Comments
 (0)