Files
speckle-server/packages/server/test/speckle-helpers/workspaces.ts
T
Kristaps Fabians Geikins e24c26e3d2 feat: getting rid of defaultProjectRole setting (#4221)
* feat: getting rid of defaultProjectRole setting

* get stdout reporting in CI

* yarn lock fix

* fix package.json

* better CI test output

* pinning mocha-multi
2025-03-20 12:58:30 +02:00

25 lines
855 B
TypeScript

import { UpsertWorkspace } from '@/modules/workspaces/domain/operations'
import { Workspace } from '@/modules/workspacesCore/domain/types'
import cryptoRandomString from 'crypto-random-string'
export const createAndStoreTestWorkspaceFactory =
({ upsertWorkspace }: { upsertWorkspace: UpsertWorkspace }) =>
async (workspaceOverrides: Partial<Workspace> = {}) => {
const workspace: Omit<Workspace, 'domains'> = {
id: cryptoRandomString({ length: 10 }),
slug: cryptoRandomString({ length: 10 }),
name: cryptoRandomString({ length: 10 }),
createdAt: new Date(),
updatedAt: new Date(),
description: null,
logo: null,
domainBasedMembershipProtectionEnabled: false,
discoverabilityEnabled: false,
...workspaceOverrides
}
await upsertWorkspace({ workspace })
return workspace
}