import path from "path" ; import del from "del" ; import * as fs from "fs/promises" ; import { getTestCredential , TEST_SPREADSHEET_ID } from "../test/GoogleCredential" ; import { User } from "../domain/User" ; const TARGET_USERS_DIR = path . join ( __dirname , ".target" ) ; async function prepareForTest ( ) { await del ( [ TARGET_USERS_DIR ] ) ; await fs . mkdir ( TARGET_USERS_DIR , { recursive : true } ) ; const user = { credentials : getTestCredential ( ) , spreadsheetId : TEST_SPREADSHEET_ID , defaultCurrency : "JPY" , name : "test" , id : "test" , avatarUrl : "https://example.com/test.png" } ; await fs . writeFile ( path . join ( TARGET_USERS_DIR , "test.json" ) , JSON . stringify ( user ) ) ; } prepareForTest ( ) . catch ( ( error ) => { console . error ( error ) ; process . exit ( 1 ) ; } ) ;