-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
54 lines (53 loc) · 2.2 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* @jest-environment jsdom
*/
import { describe, test, expect } from '@jest/globals';
import { valks } from './src/scripts/guide';
// test valk guides
// valks
for (let i = 0; i < valks.length; i++) {
describe(valks[i].name, () => {
// builds
for (let j = 0; j < Object.keys(valks[i].builds).length; j++) {
describe(`Build #${j + 1}`, () => {
// signet tables
const signetTables = Object.keys(valks[i].builds[j].signetTable);
const [, ...signetTableNoEx] = signetTables; // exclude exclusive signets
signetTableNoEx.forEach((tableName) => {
describe(`${tableName.charAt(0).toUpperCase() + tableName.slice(1)} Signets`, () => {
// signet owners
const signetTables = valks[i].builds[j].signetTable[tableName];
const signetOwners = Object.keys(signetTables);
signetOwners.forEach((signetOwner, index) => {
describe(signetOwner, () => {
const signetNames = signetTables[signetOwner];
describe('Display', () => {
test('Signet image is correct', () => {
expect(signetOwner).toEqual(valks[i].builds[j].signet[tableName][index][0].name);
});
// check nexus series if nexus series is in guide
const nexusName = signetNames.find((signet) => `${signet}`.includes('Nexus'));
if (nexusName) {
const nexusSeries = valks[i].builds[j].signet[tableName][index][1];
const nexusSeriesName = valks[i].builds[j].signet[tableName][index][0][`nexus${nexusSeries}`].name;
test('Nexus series is correct', () => {
expect(nexusName).toEqual(nexusSeriesName);
});
}
});
// check signet names are not undefined
describe('Signets', () => {
signetNames.forEach((signet) => {
test(signet, () => {
expect(signet !== undefined).toBe(true);
});
});
});
});
});
});
});
})
}
});
}