refactor: improve type safety and code style
Some checks failed
CI / build-and-test (push) Failing after 24m31s

This commit is contained in:
sokol
2026-02-20 11:22:56 +03:00
parent 1c27b68965
commit e4b44c7b5e
7 changed files with 30 additions and 22 deletions

View File

@@ -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);