1- import { vi } from "vitest " ;
1+ import { mock } from "bun:test " ;
22import path from "path" ;
33import fs from "fs-extra" ;
44import { fileURLToPath } from "url" ;
55
66const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
77const fixturesDir = path . join ( __dirname , "../../test/fixtures" ) ;
88
9- export const createApiClient = vi . fn ( ( ) => {
9+ export const createApiClient = mock ( ( ) => {
1010 return {
11- getFileComponents : vi . fn ( async ( ) => {
11+ getFileComponents : mock ( async ( ) => {
1212 return await fs . readJson ( path . join ( fixturesDir , "file-components.json" ) ) ;
1313 } ) ,
14- getFileComponentSets : vi . fn ( async ( ) => {
14+ getFileComponentSets : mock ( async ( ) => {
1515 return await fs . readJson ( path . join ( fixturesDir , "file-component-sets.json" ) ) ;
1616 } ) ,
17- getFileNodes : vi . fn ( async ( _ , { ids } : { ids : string } ) => {
17+ getFileNodes : mock ( async ( _ , { ids } : { ids : string } ) => {
1818 const componentNodesData = await fs . readJson ( path . join ( fixturesDir , "component-nodes.json" ) ) ;
1919 const componentSetNodesData = await fs . readJson (
2020 path . join ( fixturesDir , "component-set-nodes.json" ) ,
@@ -36,10 +36,10 @@ export const createApiClient = vi.fn(() => {
3636
3737 return { nodes : filteredNodes } ;
3838 } ) ,
39- getFileStyles : vi . fn ( async ( ) => {
39+ getFileStyles : mock ( async ( ) => {
4040 return await fs . readJson ( path . join ( fixturesDir , "file-styles.json" ) ) ;
4141 } ) ,
42- getLocalVariables : vi . fn ( async ( ) => {
42+ getLocalVariables : mock ( async ( ) => {
4343 return await fs . readJson ( path . join ( fixturesDir , "file-variables.json" ) ) ;
4444 } ) ,
4545 } ;
0 commit comments