1+ import { createDatabaseToken } from '../../../src/app/openops-tables/create-database-token' ;
2+
13const openopsCommonMock = {
24 ...jest . requireActual ( '@openops/common' ) ,
35 makeOpenOpsTablesPost : jest . fn ( ) ,
@@ -30,6 +32,16 @@ jest.mock('../../../src/app/openops-tables/list-databases', () => {
3032 return { listDatabases : listDatabasesMock } ;
3133} ) ;
3234
35+ const listDatabaseTokensMock = jest . fn ( ) ;
36+ jest . mock ( '../../../src/app/openops-tables/list-database-tokens' , ( ) => {
37+ return { listDatabaseTokens : listDatabaseTokensMock } ;
38+ } ) ;
39+
40+ const createDatabaseTokenMock = jest . fn ( ) ;
41+ jest . mock ( '../../../src/app/openops-tables/create-database-token' , ( ) => {
42+ return { createDatabaseToken : createDatabaseTokenMock } ;
43+ } ) ;
44+
3345import { OPENOPS_DEFAULT_DATABASE_NAME } from '@openops/common' ;
3446import { createDefaultWorkspaceAndDatabase } from '../../../src/app/openops-tables/default-workspace-database' ;
3547
@@ -43,9 +55,11 @@ describe('createAdminInOpenOpsTables', () => {
4355 it ( 'should successfully create new table Opportunities' , async ( ) => {
4456 listDatabasesMock . mockResolvedValue ( [ ] ) ;
4557 listWorkspacesMock . mockResolvedValue ( [ ] ) ;
58+ listDatabaseTokensMock . mockResolvedValue ( [ ] ) ;
4659 createWorkspaceMock . mockResolvedValue ( { id : 1 } ) ;
4760 createDbMock . mockResolvedValue ( { id : 2 } ) ;
4861 createTableMock . mockResolvedValue ( { id : 3 } ) ;
62+ createDatabaseTokenMock . mockResolvedValue ( { key : 'key' } ) ;
4963
5064 await createDefaultWorkspaceAndDatabase ( token ) ;
5165
0 commit comments