Skip to content

Commit 545a451

Browse files
committed
chore(tests): Fix e2e test
1 parent 0f78a16 commit 545a451

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/minio/minio.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { UploadedObjectInfo } from 'minio/dist/main/internal/type';
1212

1313
export interface PutOptions {
1414
id?: string;
15-
metadata?: Record<string, any>; // camel
15+
metadata?: Record<string, any>;
1616
bucket?: string;
1717
folder?: string;
1818
}

src/tasks/task-pipeline.e2e-spec.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ class MockWizardWorker {
1717
private isPolling = false;
1818
private pollingInterval: NodeJS.Timeout | null = null;
1919
private readonly pollIntervalMs = 500; // Fast polling for tests
20+
private readonly namespaceId: string;
2021

21-
constructor(private readonly client: TestClient) {}
22+
constructor(private readonly client: TestClient) {
23+
this.namespaceId = client.namespace.id;
24+
}
2225

2326
/**
2427
* Starts polling for tasks and processing them
@@ -87,7 +90,7 @@ class MockWizardWorker {
8790
private async fetchTask(): Promise<TaskDto | null> {
8891
try {
8992
const response = await this.makeRequest()
90-
.get('/internal/api/v1/wizard/task')
93+
.get(`/internal/api/v1/wizard/task?namespace_id=${this.namespaceId}`)
9194
.timeout(5000); // 5 second timeout
9295

9396
if (response.status === 204) {
@@ -282,20 +285,16 @@ describe('Task Pipeline (e2e)', () => {
282285
let client: TestClient;
283286
let mockWorker: MockWizardWorker;
284287

285-
beforeAll(async () => {
288+
beforeEach(async () => {
286289
client = await TestClient.create();
287290
mockWorker = new MockWizardWorker(client);
288291
});
289292

290-
afterAll(async () => {
291-
await mockWorker.deleteAllTasks();
293+
afterEach(async () => {
294+
mockWorker.stopPolling();
292295
await client.close();
293296
});
294297

295-
beforeEach(async () => {
296-
await mockWorker.deleteAllTasks();
297-
});
298-
299298
describe('Basic Task Processing', () => {
300299
it('create resource trigger upsertIndex', async () => {
301300
mockWorker.startPolling();

src/wizard/internal.wizard.e2e-spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import { gzipSync } from 'zlib';
66
describe('InternalWizardController (e2e)', () => {
77
let client: TestClient;
88

9-
beforeAll(async () => {
9+
beforeEach(async () => {
1010
client = await TestClient.create();
1111
});
1212

13-
afterAll(async () => {
13+
afterEach(async () => {
1414
await client.close();
1515
});
1616

@@ -44,7 +44,8 @@ describe('InternalWizardController (e2e)', () => {
4444
.get(`/internal/api/v1/wizard/task?namespace_id=${client.namespace.id}`)
4545
.expect(HttpStatus.OK);
4646

47-
expect(task.body.input.html).toEqual(html);
47+
expect(task.body.id).toBe(taskId);
48+
expect(task.body.input.html).toBe(html);
4849

4950
const response = await client
5051
.post('/internal/api/v1/wizard/callback')
@@ -86,7 +87,8 @@ describe('InternalWizardController (e2e)', () => {
8687
.get(`/internal/api/v1/wizard/task?namespace_id=${client.namespace.id}`)
8788
.expect(HttpStatus.OK);
8889

89-
expect(task.body.input.html).toEqual(collectData.html);
90+
expect(task.body.id).toBe(taskId);
91+
expect(task.body.input.html).toBe(collectData.html);
9092

9193
const response = await client
9294
.post('/internal/api/v1/wizard/callback')

0 commit comments

Comments
 (0)