feat(workspaces): add repository function implementations

Co-authored-by: Charles Driesler <chuck@speckle.systems>
This commit is contained in:
Gergő Jedlicska
2024-07-04 14:46:48 +02:00
committed by GitHub
parent 8ba0b09f45
commit 28ce7c757c
10 changed files with 201 additions and 27 deletions
@@ -4,12 +4,12 @@ import { Roles } from '@speckle/shared'
import { expect } from 'chai'
import cryptoRandomString from 'crypto-random-string'
describe('Workspace creation', () => {
describe('Workspace services', () => {
describe('createWorkspaceFactory creates a function, that', () => {
it('stores the workspace', async () => {
const storedWorkspaces: Workspace[] = []
const createWorkspace = createWorkspaceFactory({
storeWorkspace: async ({ workspace }: { workspace: Workspace }) => {
upsertWorkspace: async ({ workspace }: { workspace: Workspace }) => {
storedWorkspaces.push(workspace)
},
upsertWorkspaceRole: async () => {},
@@ -32,7 +32,7 @@ describe('Workspace creation', () => {
it('makes the workspace creator becomes a workspace:admin', async () => {
const storedRole: WorkspaceAcl[] = []
const createWorkspace = createWorkspaceFactory({
storeWorkspace: async () => {},
upsertWorkspace: async () => {},
upsertWorkspaceRole: async (workspaceAcl: WorkspaceAcl) => {
storedRole.push(workspaceAcl)
},
@@ -64,7 +64,7 @@ describe('Workspace creation', () => {
payload: {}
}
const createWorkspace = createWorkspaceFactory({
storeWorkspace: async () => {},
upsertWorkspace: async () => {},
upsertWorkspaceRole: async () => {},
emitWorkspaceEvent: async ({ event, payload }) => {
eventData.isCalled = true