Skip to content

Commit d85c92c

Browse files
committed
fix: e2e
1 parent 42dbb76 commit d85c92c

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
9292
await permanentDeleteBase(base.id);
9393
if (duplicateBaseId) {
9494
await permanentDeleteBase(duplicateBaseId);
95+
duplicateBaseId = undefined;
9596
}
9697
});
9798

@@ -604,7 +605,6 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
604605
expect(baseResult.data.length).toBe(1);
605606

606607
expect(tableResult.data.length).toBe(1);
607-
await deleteBase(dupResult.data.id);
608608
});
609609
});
610610

@@ -633,7 +633,7 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
633633
spaceId: spaceId,
634634
name: 'test base copy',
635635
});
636-
636+
duplicateBaseId = dupResult.data.id;
637637
const newBaseId = dupResult.data.id;
638638

639639
const dashboardList = (await getDashboardList(newBaseId)).data;
@@ -651,8 +651,6 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
651651

652652
expect(dashboardList.length).toBe(2);
653653
expect(installedPlugins.name).toBe('plugin1');
654-
655-
await deleteBase(dupResult.data.id);
656654
});
657655

658656
it('should duplicate all panel plugins', async () => {
@@ -681,7 +679,7 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
681679
spaceId: spaceId,
682680
name: 'test base copy',
683681
});
684-
682+
duplicateBaseId = dupResult.data.id;
685683
const panelList = (await listPluginPanels(pluginTable.id)).data;
686684

687685
const panel1Info = (
@@ -699,8 +697,6 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
699697
expect(panel1Info.layout?.length).toBe(2);
700698
expect(panelList.length).toBe(2);
701699
expect(installedPlugins.name).toBe('plugin1');
702-
703-
await deleteBase(dupResult.data.id);
704700
});
705701

706702
it('should duplicate all view plugins', async () => {
@@ -719,7 +715,7 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
719715
spaceId: spaceId,
720716
name: 'test base copy',
721717
});
722-
718+
duplicateBaseId = dupResult.data.id;
723719
const views = (await getViewList(tableId)).data;
724720

725721
const pluginViews = views.filter(({ type }) => type === ViewType.Plugin);
@@ -728,8 +724,6 @@ describe('OpenAPI Base Duplicate (e2e)', () => {
728724

729725
expect(pluginViews.find(({ name }) => name === sheetView1.name)).toBeDefined();
730726
expect(pluginViews.find(({ name }) => name === sheetView2.name)).toBeDefined();
731-
732-
await deleteBase(dupResult.data.id);
733727
});
734728
});
735729
});

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('BaseNodeController (e2e) /api/base/:baseId/node', () => {
128128

129129
afterEach(async () => {
130130
// Cleanup created nodes
131-
for (const nodeId of nodesToCleanup) {
131+
for (const nodeId of [...nodesToCleanup].reverse()) {
132132
await deleteBaseNode(baseId, nodeId);
133133
}
134134
nodesToCleanup.length = 0;
@@ -404,7 +404,7 @@ describe('BaseNodeController (e2e) /api/base/:baseId/node', () => {
404404
const nodesToCleanup: string[] = [];
405405

406406
afterEach(async () => {
407-
for (const nodeId of nodesToCleanup) {
407+
for (const nodeId of [...nodesToCleanup].reverse()) {
408408
await deleteBaseNode(baseId, nodeId);
409409
}
410410
nodesToCleanup.length = 0;
@@ -686,7 +686,7 @@ describe('BaseNodeController (e2e) /api/base/:baseId/node', () => {
686686
const nodesToCleanup: string[] = [];
687687

688688
afterEach(async () => {
689-
for (const nodeId of nodesToCleanup) {
689+
for (const nodeId of [...nodesToCleanup].reverse()) {
690690
await deleteBaseNode(baseId, nodeId);
691691
}
692692
nodesToCleanup.length = 0;
@@ -756,7 +756,7 @@ describe('BaseNodeController (e2e) /api/base/:baseId/node', () => {
756756
const nodesToCleanup: string[] = [];
757757

758758
afterEach(async () => {
759-
for (const nodeId of nodesToCleanup) {
759+
for (const nodeId of [...nodesToCleanup].reverse()) {
760760
await deleteBaseNode(baseId, nodeId);
761761
}
762762
nodesToCleanup.length = 0;
@@ -1127,12 +1127,8 @@ describe('BaseNodeController (e2e) /api/base/:baseId/node', () => {
11271127

11281128
afterAll(async () => {
11291129
// Cleanup nodes first
1130-
for (const nodeId of nodesToCleanup) {
1131-
try {
1132-
await deleteBaseNode(permissionBaseId, nodeId);
1133-
} catch (e) {
1134-
// Ignore cleanup errors
1135-
}
1130+
for (const nodeId of [...nodesToCleanup].reverse()) {
1131+
await deleteBaseNode(permissionBaseId, nodeId);
11361132
}
11371133
// Then delete the space (which will delete the base)
11381134
await apiPermanentDeleteSpace(permissionSpaceId);
@@ -1339,7 +1335,7 @@ describe('BaseNodeController (e2e) /api/base/:baseId/node', () => {
13391335
const creatorNodesToCleanup: string[] = [];
13401336

13411337
afterEach(async () => {
1342-
for (const nodeId of creatorNodesToCleanup) {
1338+
for (const nodeId of [...creatorNodesToCleanup].reverse()) {
13431339
await deleteBaseNode(permissionBaseId, nodeId);
13441340
}
13451341
creatorNodesToCleanup.length = 0;

0 commit comments

Comments
 (0)