refactor: improve type safety and code style
Some checks failed
CI / build-and-test (push) Failing after 24m31s
Some checks failed
CI / build-and-test (push) Failing after 24m31s
This commit is contained in:
@@ -36,8 +36,8 @@ const cfgTemplate = `
|
||||
|
||||
|
||||
test("read from a file", async ({expect})=>{
|
||||
let sut = new ConfigReader();
|
||||
let file = new File([cfgTemplate],'cfg.json.xml',{type:'application/xml'});
|
||||
const sut = new ConfigReader();
|
||||
const file = new File([cfgTemplate],'cfg.json.xml',{type:'application/xml'});
|
||||
|
||||
// define a missing jsdom text() function,
|
||||
// that presents in the real DOM
|
||||
@@ -46,15 +46,15 @@ test("read from a file", async ({expect})=>{
|
||||
writable: true
|
||||
});
|
||||
|
||||
let cfg = await sut.parseFromFile(file);
|
||||
const cfg = await sut.parseFromFile(file);
|
||||
|
||||
expect(cfg).not.toBeUndefined();
|
||||
});
|
||||
|
||||
test("load environments and params", ({expect})=>{
|
||||
let sut = new ConfigReader();
|
||||
const sut = new ConfigReader();
|
||||
|
||||
let cfg = sut.parseFromString(cfgTemplate);
|
||||
const cfg = sut.parseFromString(cfgTemplate);
|
||||
|
||||
expect(cfg?.envs).toHaveLength(3);
|
||||
expect(cfg?.envs.map(x=>x.name))
|
||||
@@ -64,9 +64,9 @@ test("load environments and params", ({expect})=>{
|
||||
});
|
||||
|
||||
test("load template", ({expect})=>{
|
||||
let sut = new ConfigReader();
|
||||
const sut = new ConfigReader();
|
||||
|
||||
let cfg = sut.parseFromString(cfgTemplate);
|
||||
const cfg = sut.parseFromString(cfgTemplate);
|
||||
|
||||
expect(cfg?.template).toBeDefined();
|
||||
expect(cfg?.template.content.length).toBeGreaterThan(20);
|
||||
|
||||
Reference in New Issue
Block a user