Skip to content

Commit f64141a

Browse files
authored
fix: duplicate base which relative with auth e2e (#1444)
1 parent 080a75c commit f64141a

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

apps/nestjs-backend/test/base-duplicate.e2e-spec.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable sonarjs/no-duplicate-string */
22
import type { INestApplication } from '@nestjs/common';
33
import type { IFieldRo, ILinkFieldOptions, ILookupOptionsRo } from '@teable/core';
4-
import { DriverClient, FieldType, Relationship, ViewType } from '@teable/core';
4+
import { DriverClient, FieldType, Relationship, Role, ViewType } from '@teable/core';
55
import type { ICreateBaseVo, ICreateSpaceVo } from '@teable/openapi';
66
import {
7+
CREATE_SPACE,
78
createBase,
89
createDashboard,
910
createField,
@@ -12,6 +13,7 @@ import {
1213
deleteBase,
1314
deleteSpace,
1415
duplicateBase,
16+
EMAIL_SPACE_INVITATION,
1517
getBaseList,
1618
getDashboard,
1719
getDashboardInstallPlugin,
@@ -26,7 +28,10 @@ import {
2628
installPluginPanel,
2729
installViewPlugin,
2830
listPluginPanels,
31+
urlBuilder,
2932
} from '@teable/openapi';
33+
import type { AxiosInstance } from 'axios';
34+
import { createNewUserAxios } from './utils/axios-instance/new-user';
3035
import {
3136
convertField,
3237
createRecords,
@@ -39,11 +44,25 @@ import {
3944
describe('OpenAPI Base Duplicate (e2e)', () => {
4045
let app: INestApplication;
4146
let base: ICreateBaseVo;
42-
const spaceId = globalThis.testConfig.spaceId;
43-
47+
let spaceId: string;
48+
let newUserAxios: AxiosInstance;
4449
beforeAll(async () => {
4550
const appCtx = await initApp();
4651
app = appCtx.app;
52+
53+
newUserAxios = await createNewUserAxios({
54+
email: 'test@gmail.com',
55+
password: '12345678',
56+
});
57+
58+
const space = await newUserAxios.post<ICreateSpaceVo>(CREATE_SPACE, {
59+
name: 'test space',
60+
});
61+
spaceId = space.data.id;
62+
await newUserAxios.post(urlBuilder(EMAIL_SPACE_INVITATION, { spaceId }), {
63+
role: Role.Owner,
64+
emails: [globalThis.testConfig.email],
65+
});
4766
});
4867

4968
afterAll(async () => {

0 commit comments

Comments
 (0)