feat(server): improved subscription testing DX + tests for common subs + new subs (#3554)

* userProjectsUpdated.added test

* multi region support

* userStreamAdded

* commit subs tested

* fix for proj workspace assignment

* undo commitHelper main changes

* disable all ffs mode

* createTestWorkspace support when workspaces arent enabled

* project create fix

* workspace projects updated subscription

* WIP new workspace sub

* updated workspaceCreated

* updated workspaceUpdated

* BE for workspace updated sub

* workspace updated sub

* ts err fix
This commit is contained in:
Kristaps Fabians Geikins
2024-11-27 13:41:04 +00:00
committed by GitHub
parent 9c29ca07e3
commit 1800dbbdbd
50 changed files with 1679 additions and 266 deletions
@@ -20,10 +20,11 @@ type WorkspaceAuthorizedPayload = {
userId: string | null
workspaceId: string
}
type WorkspaceCreatedPayload = Workspace & {
type WorkspaceCreatedPayload = {
workspace: Workspace
createdByUserId: string
}
type WorkspaceUpdatedPayload = Workspace
type WorkspaceUpdatedPayload = { workspace: Workspace }
type WorkspaceRoleDeletedPayload = Pick<WorkspaceAcl, 'userId' | 'workspaceId' | 'role'>
type WorkspaceRoleUpdatedPayload = Pick<
WorkspaceAcl,
@@ -1,6 +1,10 @@
import { WorkspacesModuleDisabledError } from '@/modules/core/errors/workspaces'
import { Resolvers } from '@/modules/core/graph/generated/graphql'
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
import {
filteredSubscribe,
WorkspaceSubscriptions
} from '@/modules/shared/utils/subscriptions'
const { FF_WORKSPACES_MODULE_ENABLED } = getFeatureFlags()
@@ -115,6 +119,20 @@ export = !FF_WORKSPACES_MODULE_ENABLED
},
ServerWorkspacesInfo: {
workspacesEnabled: () => false
},
Subscription: {
workspaceProjectsUpdated: {
subscribe: filteredSubscribe(
WorkspaceSubscriptions.WorkspaceProjectsUpdated,
() => false
)
},
workspaceUpdated: {
subscribe: filteredSubscribe(
WorkspaceSubscriptions.WorkspaceUpdated,
() => false
)
}
}
} as Resolvers)
: {}