Skip to content

Commit 0bc90e6

Browse files
committed
fix projects test
1 parent dcb153f commit 0bc90e6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/integration/tools/atlas/projects.test.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ObjectId } from "mongodb";
2-
import { parseTable, describeWithAtlas } from "./atlasHelpers.js";
2+
import { describeWithAtlas } from "./atlasHelpers.js";
33
import { expectDefined, getDataFromUntrustedContent, getResponseElements } from "../../helpers.js";
44
import { afterAll, describe, expect, it } from "vitest";
55

@@ -63,14 +63,20 @@ describeWithAtlas("projects", (integration) => {
6363
expect(elements).toHaveLength(2);
6464
expect(elements[1]?.text).toContain("<untrusted-user-data-");
6565
expect(elements[1]?.text).toContain(projName);
66-
const data = parseTable(getDataFromUntrustedContent(elements[1]?.text ?? ""));
66+
67+
const raw = getDataFromUntrustedContent(elements[1]?.text ?? "");
68+
const data = JSON.parse(raw) as Array<{
69+
name: string;
70+
id: string;
71+
organizationName: string;
72+
organizationId: string;
73+
createdAt: string;
74+
}>;
75+
76+
expect(Array.isArray(data)).toBe(true);
6777
expect(data.length).toBeGreaterThan(0);
68-
let found = false;
69-
for (const project of data) {
70-
if (project["Project Name"] === projName) {
71-
found = true;
72-
}
73-
}
78+
79+
const found = data.some((project) => project.name === projName);
7480
expect(found).toBe(true);
7581

7682
expect(elements[0]?.text).toBe(`Found ${data.length} projects`);

0 commit comments

Comments
 (0)