Format tests

This commit is contained in:
Zoë Hoekstra 2022-10-09 12:44:55 +02:00
parent fb4cc4f707
commit f17f89706a
No known key found for this signature in database
GPG key ID: F9B7B7D8130F3323
2 changed files with 7 additions and 12 deletions

View file

@ -34,33 +34,28 @@ describe("messageGenerators", () => {
describe("addLeadingSlash", () => { describe("addLeadingSlash", () => {
it("should add a leading slash if a file in a folder is sent", () => { it("should add a leading slash if a file in a folder is sent", () => {
const msg = fileRemovalEventToMsg({path: "sub/test.js"}); const msg = fileRemovalEventToMsg({ path: "sub/test.js" });
const result = (msg?.params as FileData).filename; const result = (msg?.params as FileData).filename;
if(result && result.hasOwnProperty("filename")) if (result && result.hasOwnProperty("filename")) expect(result).to.eq("/sub/test.js");
expect(result).to.eq("/sub/test.js")
}); });
}); });
describe("addLeadingSlash", () => { describe("addLeadingSlash", () => {
it("should not add a leading slash if a file in the root folder is sent", () => { it("should not add a leading slash if a file in the root folder is sent", () => {
const msg = fileRemovalEventToMsg({path: "test.js"}); const msg = fileRemovalEventToMsg({ path: "test.js" });
const result = (msg?.params as FileData).filename; const result = (msg?.params as FileData).filename;
if(result && result.hasOwnProperty("filename")) if (result && result.hasOwnProperty("filename")) expect(result).to.eq("test.js");
expect(result).to.eq("test.js")
}); });
}); });
describe("addLeadingSlash", () => { describe("addLeadingSlash", () => {
it("should return with one leading slash if a file in a folder is sent and file already is prefixed", () => { it("should return with one leading slash if a file in a folder is sent and file already is prefixed", () => {
const msg = fileRemovalEventToMsg({path: "/sub/test.js"}); const msg = fileRemovalEventToMsg({ path: "/sub/test.js" });
const result = (msg?.params as FileData).filename; const result = (msg?.params as FileData).filename;
if(result && result.hasOwnProperty("filename")) if (result && result.hasOwnProperty("filename")) expect(result).to.eq("/sub/test.js");
expect(result).to.eq("/sub/test.js")
}); });
}); });
}); });

View file

@ -31,5 +31,5 @@ describe("messageTracker", () => {
expect(msg0).to.eq(undefined); expect(msg0).to.eq(undefined);
expect(msg1?.result).to.eq("testvalue1"); expect(msg1?.result).to.eq("testvalue1");
expect(msg200?.result).to.eq("testvalue200"); expect(msg200?.result).to.eq("testvalue200");
}) });
}); });