Skip to content

Commit

Permalink
updated uuid test
Browse files Browse the repository at this point in the history
  • Loading branch information
omartehsin1 committed Jul 24, 2023
1 parent d8423e8 commit d0b1be1
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions uuid.test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
const fs = require("fs");
const filesEN = fs.readdirSync("./content/en/careers/positions/");
const filesFR = fs.readdirSync("./content/fr/careers/positions/")
const archFalse = /archived: false/i;
const UUIDRegex =/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/;

test("UUID in correct format EN", () => {
filesEN.forEach((element) => {
let data = fs.readFileSync(
`./content/en/careers/positions/${element}`,
"utf8"
);
if (archFalse.test(data)) {
const found = data.match(UUIDRegex);
expect(found).not.toBeNull();
}

if (fs.readdirSync("./content/en/careers/positions/")) {
const filesEN = fs.readdirSync("./content/en/careers/positions/");
test("UUID in correct format EN", () => {
filesEN.forEach((element) => {
let data = fs.readFileSync(
`./content/en/careers/positions/${element}`,
"utf8"
);
if (archFalse.test(data)) {
const found = data.match(UUIDRegex);
expect(found).not.toBeNull();
}
});
});
});
}

test("UUID in correct format FR", () => {
if (fs.readdirSync("./content/fr/careers/positions/")) {
const filesFR = fs.readdirSync("./content/fr/careers/positions/")
test("UUID in correct format FR", () => {
filesFR.forEach((element) => {
let data = fs.readFileSync(
`./content/fr/careers/positions/${element}`,
Expand All @@ -28,4 +32,5 @@ test("UUID in correct format FR", () => {
expect(found).not.toBeNull();
}
});
});
});
}

0 comments on commit d0b1be1

Please sign in to comment.