|
|
@@ -94,6 +94,16 @@ describe("a red many pulls share", () => { |
| 94 | 94 |
expect(shared(red("i3", [other]))).toBe(true); |
| 95 | 95 |
}); |
| 96 | 96 |
|
| 97 |
test("an /api/v1 route a pull left undescribed is that pull's own red, not the lane's (#8140)", () => { |
| 98 |
const gate = "every registered /api/v1 route has an OpenAPI row or is listed as not yet described"; |
| 99 |
for (const i of ["i1", "i2", "i3"]) red(i, [gate]); |
| 100 |
expect(shared(red("i4", [gate]))).toBe(false); |
| 101 |
const index = "the gathered routes > the index is current: run `bun scripts/openapi-routes.ts`"; |
| 102 |
for (const i of ["i1", "i2", "i3"]) red(i, [index]); |
| 103 |
expect(shared(red("i4", [index]))).toBe(false); |
| 104 |
expect(sharedTests(db)).toEqual([]); |
| 105 |
}); |
| 106 |
|
| 97 | 107 |
test("every tree gate names a suite, or a test in it, that exists", () => { |
| 98 | 108 |
const names = new Set<string>(); |
| 99 | 109 |
for (const f of new Glob("test/*.test.ts").scanSync(".")) for (const n of suiteNames(readFileSync(f, "utf8"))) names.add(n); |
|
|
@@ -106,6 +116,7 @@ describe("a red many pulls share", () => { |
| 106 | 116 |
expect(names.has("B > u")).toBe(true); |
| 107 | 117 |
expect(names.has("B > t")).toBe(false); |
| 108 | 118 |
expect(names.has("A > u")).toBe(false); |
| 119 |
expect(suiteNames('test("top", () => {});\n').has("top")).toBe(true); |
| 109 | 120 |
}); |
| 110 | 121 |
|
| 111 | 122 |
test("one pull red three times is its own red, not the lane's", () => { |
|
|
@@ -275,7 +286,7 @@ function suiteNames(text: string): Set<string> { |
| 275 | 286 |
let suite: string | undefined; |
| 276 | 287 |
for (const m of text.matchAll(/\b(describe|test)\("((?:[^"\\]|\\.)*)"/g)) { |
| 277 | 288 |
if (m[1] === "describe") names.add(`${(suite = m[2])} > `); |
| 278 | |
else if (suite !== undefined) names.add(`${suite} > ${m[2]}`); |
| 289 |
else names.add(suite === undefined ? m[2]! : `${suite} > ${m[2]}`); |
| 279 | 290 |
} |
| 280 | 291 |
return names; |
| 281 | 292 |
} |