File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
tests/integration/tools/atlas Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 11import { ObjectId } from "mongodb" ;
2- import { parseTable , describeWithAtlas } from "./atlasHelpers.js" ;
2+ import { describeWithAtlas } from "./atlasHelpers.js" ;
33import { expectDefined , getDataFromUntrustedContent , getResponseElements } from "../../helpers.js" ;
44import { 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` ) ;
You can’t perform that action at this time.
0 commit comments