Skip to content

Commit 6a43776

Browse files
committed
fix(tests): seed Project membership in new staging fixtures
1 parent 2f76202 commit 6a43776

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎apps/sim/lib/logs/public-queries.integration.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
workflowExecutionSnapshots,
1313
workspace,
1414
} from '@sim/db/schema'
15+
import { deleteWorkspaceFixture, insertWorkspaceFixture } from '@sim/db/testing/workspace-fixtures'
1516
import { generateId } from '@sim/utils/id'
1617
import { eq, sql } from 'drizzle-orm'
1718
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
@@ -84,7 +85,7 @@ beforeAll(async () => {
8485
createdAt: now,
8586
updatedAt: now,
8687
})
87-
await db.insert(workspace).values({
88+
await insertWorkspaceFixture(db, {
8889
id: ids.workspace,
8990
name: 'Public Log Paging',
9091
ownerId: ids.owner,
@@ -136,7 +137,7 @@ afterAll(async () => {
136137
await db.delete(jobExecutionLogs).where(eq(jobExecutionLogs.workspaceId, ids.workspace))
137138
await db.delete(workflowExecutionSnapshots).where(eq(workflowExecutionSnapshots.id, ids.snapshot))
138139
await db.delete(workflow).where(eq(workflow.id, ids.workflow))
139-
await db.delete(workspace).where(eq(workspace.id, ids.workspace))
140+
await deleteWorkspaceFixture(db, eq(workspace.id, ids.workspace))
140141
await db.delete(user).where(eq(user.id, ids.owner))
141142
})
142143

‎apps/sim/lib/mothership/chat/application/read-stream-status.integration.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** Exercises the transcript-free stream status read against real PostgreSQL rows. */
22
import { db } from '@sim/db'
33
import { copilotChats, permissions, user, workspace } from '@sim/db/schema'
4+
import { deleteWorkspaceFixture, insertWorkspaceFixture } from '@sim/db/testing/workspace-fixtures'
45
import { createSessionPrincipal } from '@sim/testing/factories/principal.factory'
56
import { generateId } from '@sim/utils/id'
67
import { eq, inArray } from 'drizzle-orm'
@@ -33,7 +34,7 @@ beforeAll(async () => {
3334
updatedAt: now,
3435
}))
3536
)
36-
await db.insert(workspace).values({
37+
await insertWorkspaceFixture(db, {
3738
id: workspaceId,
3839
name: 'Chat stream status fixture',
3940
ownerId,
@@ -52,7 +53,7 @@ beforeAll(async () => {
5253

5354
afterAll(async () => {
5455
await db.delete(copilotChats).where(eq(copilotChats.workspaceId, workspaceId))
55-
await db.delete(workspace).where(eq(workspace.id, workspaceId))
56+
await deleteWorkspaceFixture(db, eq(workspace.id, workspaceId))
5657
await db.delete(user).where(inArray(user.id, [ownerId, memberId]))
5758
await db.$client.end()
5859
})

‎apps/sim/lib/workspaces/__integration__/recently-deleted.integration.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
workspace,
1010
workspaceFiles,
1111
} from '@sim/db/schema'
12+
import { deleteWorkspaceFixture, insertWorkspaceFixture } from '@sim/db/testing/workspace-fixtures'
1213
import { generateId } from '@sim/utils/id'
1314
import { inArray, sql } from 'drizzle-orm'
1415
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
@@ -103,7 +104,8 @@ describe('Recently Deleted listing against PostgreSQL', () => {
103104
updatedAt: now,
104105
}))
105106
)
106-
await db.insert(workspace).values(
107+
await insertWorkspaceFixture(
108+
db,
107109
[workspaceId, otherWorkspaceId].map((id) => ({
108110
id,
109111
name: 'Recently deleted fixture',
@@ -216,7 +218,7 @@ describe('Recently Deleted listing against PostgreSQL', () => {
216218
})
217219

218220
afterAll(async () => {
219-
await db.delete(workspace).where(inArray(workspace.id, [workspaceId, otherWorkspaceId]))
221+
await deleteWorkspaceFixture(db, inArray(workspace.id, [workspaceId, otherWorkspaceId]))
220222
await db.delete(user).where(inArray(user.id, [aliceId, bobId]))
221223
await db.$client.end()
222224
})

0 commit comments

Comments
 (0)