Skip to content

Commit d55d384

Browse files
committed
Fix ParsedEnvironmentFile tests
1 parent 7c6d1e8 commit d55d384

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

test/unitTests/ParsedEnvironmentFile.test.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,25 @@ suite("ParsedEnvironmentFile", () => {
1111

1212
test("Add single variable", () => {
1313
const content = `MyName=VALUE`;
14-
const fakeConfig: { [key: string]: any } = {};
15-
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
14+
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", undefined);
1615

17-
expect(result.Warning).to.be.null;
16+
expect(result.Warning).to.be.undefined;
1817
result.Env["MyName"].should.equal("VALUE");
1918
});
2019

2120
test("Handle quoted values", () => {
2221
const content = `MyName="VALUE"`;
23-
const fakeConfig: { [key: string]: any } = {};
24-
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
22+
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", undefined);
2523

26-
expect(result.Warning).to.be.null;
24+
expect(result.Warning).to.be.undefined;
2725
result.Env["MyName"].should.equal("VALUE");
2826
});
2927

3028
test("Handle BOM", () => {
3129
const content = "\uFEFFMyName=VALUE";
32-
const fakeConfig: { [key: string]: any } = {};
33-
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
30+
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", undefined);
3431

35-
expect(result.Warning).to.be.null;
32+
expect(result.Warning).to.be.undefined;
3633
result.Env["MyName"].should.equal("VALUE");
3734
});
3835

@@ -42,10 +39,9 @@ MyName1=Value1
4239
MyName2=Value2
4340
4441
`;
45-
const fakeConfig: { [key: string]: any } = {};
46-
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
42+
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", undefined);
4743

48-
expect(result.Warning).to.be.null;
44+
expect(result.Warning).to.be.undefined;
4945
result.Env["MyName1"].should.equal("Value1");
5046
result.Env["MyName2"].should.equal("Value2");
5147
});
@@ -56,13 +52,13 @@ MyName1=Value1
5652
MyName2=Value2
5753
5854
`;
59-
const initialEnv: { [key: string]: any } = {
55+
const initialEnv = {
6056
"MyName1": "Value7",
6157
"ThisShouldNotChange": "StillHere"
6258
};
6359
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", initialEnv);
6460

65-
expect(result.Warning).to.be.null;
61+
expect(result.Warning).to.be.undefined;
6662
result.Env["MyName1"].should.equal("Value1");
6763
result.Env["MyName2"].should.equal("Value2");
6864
result.Env["ThisShouldNotChange"].should.equal("StillHere");
@@ -74,10 +70,9 @@ MyName1=Value1
7470
# This is a comment in the middle of the file
7571
MyName2=Value2
7672
`;
77-
const fakeConfig: { [key: string]: any } = {};
78-
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
73+
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", undefined);
7974

80-
expect(result.Warning).to.be.null;
75+
expect(result.Warning).to.be.undefined;
8176
result.Env["MyName1"].should.equal("Value1");
8277
result.Env["MyName2"].should.equal("Value2");
8378
});
@@ -89,10 +84,10 @@ MyName1=Value1
8984
MyName2=Value2
9085
9186
`;
92-
const fakeConfig: { [key: string]: any } = {};
93-
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
87+
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", undefined);
9488

95-
result.Warning.should.startWith("Ignoring non-parseable lines in envFile TestEnvFileName");
89+
expect(result.Warning).not.to.be.undefined;
90+
result.Warning!.should.startWith("Ignoring non-parseable lines in envFile TestEnvFileName");
9691
result.Env["MyName1"].should.equal("Value1");
9792
result.Env["MyName2"].should.equal("Value2");
9893
});

0 commit comments

Comments
 (0)