Skip to content

Commit 818e477

Browse files
author
test
committed
test(workflows): deflake workflow route auth tests
1 parent 8bb57d4 commit 818e477

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

apps/sim/app/api/workflows/[id]/route.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ describe('Workflow By ID API Route', () => {
112112

113113
afterEach(() => {
114114
vi.clearAllMocks()
115+
vi.unstubAllGlobals()
115116
})
116117

117118
describe('GET /api/workflows/[id]', () => {
@@ -143,7 +144,7 @@ describe('Workflow By ID API Route', () => {
143144
expect(data.error).toBe('Workflow not found')
144145
})
145146

146-
it.concurrent('should allow access when user has admin workspace permission', async () => {
147+
it('should allow access when user has admin workspace permission', async () => {
147148
const mockWorkflow = {
148149
id: 'workflow-123',
149150
userId: 'user-123',
@@ -181,7 +182,7 @@ describe('Workflow By ID API Route', () => {
181182
expect(data.data.id).toBe('workflow-123')
182183
})
183184

184-
it.concurrent('should allow access when user has workspace permissions', async () => {
185+
it('should allow access when user has workspace permissions', async () => {
185186
const mockWorkflow = {
186187
id: 'workflow-123',
187188
userId: 'other-user',
@@ -248,7 +249,7 @@ describe('Workflow By ID API Route', () => {
248249
expect(data.error).toBe('Unauthorized: Access denied to read this workflow')
249250
})
250251

251-
it.concurrent('should use normalized tables when available', async () => {
252+
it('should use normalized tables when available', async () => {
252253
const mockWorkflow = {
253254
id: 'workflow-123',
254255
userId: 'user-123',
@@ -464,7 +465,7 @@ describe('Workflow By ID API Route', () => {
464465
expect(data.error).toBe('Cannot delete the only workflow in the workspace')
465466
})
466467

467-
it.concurrent('should deny deletion for non-admin users', async () => {
468+
it('should deny deletion for non-admin users', async () => {
468469
mockValidateWorkflowAccess.mockResolvedValue({
469470
error: {
470471
message: 'Unauthorized: Access denied to admin this workflow',
@@ -608,7 +609,7 @@ describe('Workflow By ID API Route', () => {
608609
expect(data.error).toBe('Unauthorized: Access denied to write this workflow')
609610
})
610611

611-
it.concurrent('should validate request data', async () => {
612+
it('should validate request data', async () => {
612613
const mockWorkflow = {
613614
id: 'workflow-123',
614615
userId: 'user-123',
@@ -876,7 +877,7 @@ describe('Workflow By ID API Route', () => {
876877
})
877878

878879
describe('Error handling', () => {
879-
it.concurrent('should handle database errors gracefully', async () => {
880+
it('should handle database errors gracefully', async () => {
880881
mockGetSession({ user: { id: 'user-123' } })
881882

882883
mockGetWorkflowById.mockRejectedValue(new Error('Database connection timeout'))

0 commit comments

Comments
 (0)