-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlanguage_forge_engine_test.js
More file actions
77 lines (63 loc) · 2.28 KB
/
Copy pathlanguage_forge_engine_test.js
File metadata and controls
77 lines (63 loc) · 2.28 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// SPDX-License-Identifier: MPL-2.0
/**
* LanguageForgeEngine tests — language portfolio assessment and filtering.
*/
import { assertEquals, assert } from "jsr:@std/assert";
import * as LF from "../src/core/LanguageForgeEngine.res.js";
Deno.test("defaultState has loaded field", () => {
assertEquals(typeof LF.defaultState.loaded, "boolean");
});
Deno.test("allCategories has entries", () => {
assert(LF.allCategories.length > 0);
});
Deno.test("categoryLabel covers all categories", () => {
for (const cat of LF.allCategories) {
assert(LF.categoryLabel(cat).length > 0);
}
});
Deno.test("languageData returns non-empty array", () => {
const data = LF.languageData();
assert(data.length > 0);
});
Deno.test("languageData entries have name and phase", () => {
const data = LF.languageData();
for (const lang of data) {
assert(lang.name.length > 0);
assert(lang.phase !== undefined);
}
});
Deno.test("phaseLabel covers all phases", () => {
const phases = ["Production", "NearProduction", "Alpha", "DesignOnly", "Concept", "Vaporware"];
for (const p of phases) {
const label = LF.phaseLabel(p);
assert(typeof label === "string");
assert(label.length > 0);
}
});
Deno.test("phaseColor returns non-empty string", () => {
assert(LF.phaseColor("Production").length > 0);
});
Deno.test("filterLanguages with AllLanguages and empty query returns all", () => {
const data = LF.languageData();
const filtered = LF.filterLanguages(data, "AllLanguages", "");
assertEquals(filtered.length, data.length);
});
Deno.test("filterLanguages narrows by text", () => {
const data = LF.languageData();
const filtered = LF.filterLanguages(data, "AllLanguages", "rescript");
assert(filtered.length > 0);
assert(filtered.length < data.length);
});
Deno.test("sortLanguages by name returns same count", () => {
const data = LF.languageData();
const sorted = LF.sortLanguages(data, "SortByName");
assertEquals(sorted.length, data.length);
});
Deno.test("sortLabel covers sort options", () => {
assert(LF.sortLabel("SortByName").length > 0);
assert(LF.sortLabel("SortByPhase").length > 0);
assert(LF.sortLabel("SortByScore").length > 0);
});
Deno.test("phaseRank orders Production before Concept", () => {
assert(LF.phaseRank("Production") < LF.phaseRank("Concept"));
});