@@ -12,7 +12,6 @@ import { createStore } from "jotai";
1212import { delay , http , HttpResponse } from "msw" ;
1313import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
1414
15- import { DatabaseObject } from "~/api/materialize/objects" ;
1615import {
1716 buildColumns ,
1817 mapKyselyToTabular ,
@@ -24,7 +23,7 @@ import {
2423 useFreshnessObjectsWhere ,
2524} from "~/platform/clusters/queries" ;
2625import { allObjects } from "~/store/allObjects" ;
27- import { createProviderWrapper } from "~/test/utils" ;
26+ import { buildDatabaseObject , createProviderWrapper } from "~/test/utils" ;
2827
2928import { FreshnessScope } from "./constants" ;
3029import {
@@ -146,41 +145,26 @@ describe("freshness queries", () => {
146145 } ) ;
147146} ) ;
148147
149- const buildObject = (
150- overrides : Partial < DatabaseObject > & { id : string } ,
151- ) : DatabaseObject =>
152- ( {
153- name : overrides . id ,
154- objectType : "materialized-view" ,
155- schemaId : "u3" ,
156- schemaName : "public" ,
157- databaseId : "u1" ,
158- databaseName : "materialize" ,
159- sourceType : null ,
160- isWebhookTable : "false" ,
161- clusterId : "u1" ,
162- clusterName : "quickstart" ,
163- ...overrides ,
164- } ) as DatabaseObject ;
165-
166148// Schema u3 holds objects on two clusters and none, of every type the page
167149// either shows or must skip. Schema u9 and cluster u2 hold the decoys.
168150const ENVIRONMENT = [
169- buildObject ( { id : "u10" , objectType : "table" , clusterId : null } ) ,
170- buildObject ( { id : "u11" , objectType : "materialized-view" , clusterId : "u1" } ) ,
171- buildObject ( { id : "u12" , objectType : "index" , clusterId : "u2" } ) ,
172- buildObject ( { id : "u13" , objectType : "source" , clusterId : "u2" } ) ,
173- buildObject ( { id : "u14" , objectType : "sink" , clusterId : "u1" } ) ,
174- buildObject ( { id : "u15" , objectType : "view" , clusterId : null } ) ,
175- buildObject ( { id : "u16" , objectType : "secret" , clusterId : null } ) ,
176- buildObject ( { id : "u17" , objectType : "connection" , clusterId : null } ) ,
177- buildObject ( {
178- id : "u18" ,
179- objectType : "source" ,
180- sourceType : "subsource" ,
181- clusterId : "u2" ,
182- } ) ,
183- buildObject ( { id : "u20" , schemaId : "u9" , clusterId : "u1" } ) ,
151+ ...[
152+ { id : "u10" , objectType : "table" , clusterId : null } ,
153+ { id : "u11" , objectType : "materialized-view" , clusterId : "u1" } ,
154+ { id : "u12" , objectType : "index" , clusterId : "u2" } ,
155+ { id : "u13" , objectType : "source" , clusterId : "u2" } ,
156+ { id : "u14" , objectType : "sink" , clusterId : "u1" } ,
157+ { id : "u15" , objectType : "view" , clusterId : null } ,
158+ { id : "u16" , objectType : "secret" , clusterId : null } ,
159+ { id : "u17" , objectType : "connection" , clusterId : null } ,
160+ {
161+ id : "u18" ,
162+ objectType : "source" ,
163+ sourceType : "subsource" ,
164+ clusterId : "u2" ,
165+ } ,
166+ ] . map ( ( object ) => buildDatabaseObject ( { schemaId : "u3" , ...object } ) ) ,
167+ buildDatabaseObject ( { id : "u20" , schemaId : "u9" , clusterId : "u1" } ) ,
184168] ;
185169
186170async function objectIdsIn ( scope : FreshnessScope , scopeId : string ) {
0 commit comments