@@ -9,6 +9,7 @@ import { CardQueryResult } from "../../src/domain/card";
99import { parseJson } from "../../src/runtime/json" ;
1010
1111import { readBootstrap , type E2EBootstrap } from "./bootstrap-data" ;
12+ import { assertCompletedQuery } from "./card-query" ;
1213import { cleanupConfigHome , mkTempConfigHome , runCli } from "./run-cli" ;
1314import { E2E_DATABASES , E2E_TABLES } from "./seed/ids" ;
1415
@@ -203,11 +204,9 @@ describe("query e2e", () => {
203204
204205 expect ( result . exitCode , result . stderr ) . toBe ( 0 ) ;
205206 const queryResult = parseJson ( result . stdout , CardQueryResult ) ;
206- expect ( queryResult . status ) . toBe ( "completed" ) ;
207- if ( queryResult . status === "completed" ) {
208- expect ( queryResult . row_count ) . toBe ( 3 ) ;
209- expect ( queryResult . data . rows ) . toHaveLength ( 3 ) ;
210- }
207+ assertCompletedQuery ( queryResult ) ;
208+ expect ( queryResult . row_count ) . toBe ( 3 ) ;
209+ expect ( queryResult . data . rows ) . toHaveLength ( 3 ) ;
211210 } ) ;
212211
213212 it ( "run with a legacy native body skips MBQL 5 pre-flight and executes against /api/dataset" , async ( ) => {
@@ -225,11 +224,9 @@ describe("query e2e", () => {
225224
226225 expect ( result . exitCode , result . stderr ) . toBe ( 0 ) ;
227226 const queryResult = parseJson ( result . stdout , CardQueryResult ) ;
228- expect ( queryResult . status ) . toBe ( "completed" ) ;
229- if ( queryResult . status === "completed" ) {
230- expect ( queryResult . row_count ) . toBe ( 1 ) ;
231- expect ( queryResult . data . rows ) . toEqual ( [ [ 1 , 2 ] ] ) ;
232- }
227+ assertCompletedQuery ( queryResult ) ;
228+ expect ( queryResult . row_count ) . toBe ( 1 ) ;
229+ expect ( queryResult . data . rows ) . toEqual ( [ [ 1 , 2 ] ] ) ;
233230 } ) ;
234231
235232 it ( "--dry-run with a legacy native body returns ok and exits 0 (no schema applies)" , async ( ) => {
@@ -266,11 +263,9 @@ describe("query e2e", () => {
266263
267264 expect ( result . exitCode , result . stderr ) . toBe ( 0 ) ;
268265 const queryResult = parseJson ( result . stdout , CardQueryResult ) ;
269- expect ( queryResult . status ) . toBe ( "completed" ) ;
270- if ( queryResult . status === "completed" ) {
271- expect ( queryResult . row_count ) . toBe ( 3 ) ;
272- expect ( queryResult . data . rows ) . toHaveLength ( 3 ) ;
273- }
266+ assertCompletedQuery ( queryResult ) ;
267+ expect ( queryResult . row_count ) . toBe ( 3 ) ;
268+ expect ( queryResult . data . rows ) . toHaveLength ( 3 ) ;
274269 } ) ;
275270
276271 it ( "--dry-run with a legacy MBQL 4 body returns ok and exits 0 (server normalizes; no MBQL 5 schema applies)" , async ( ) => {
0 commit comments