Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import {loadLocalExtensionsSpecifications} from './load-specifications.js'
import {configWithoutFirstClassFields, createContractBasedModuleSpecification} from './specification.js'
import {
configWithoutFirstClassFields,
createContractBasedModuleSpecification,
createConfigExtensionSpecification,
createExtensionSpecification,
} from './specification.js'
import {BaseSchema} from './schemas.js'
import {ClientSteps} from '../../services/build/client-steps.js'
import {AppSchema} from '../app/app.js'
import {describe, test, expect, beforeAll} from 'vitest'

Expand Down Expand Up @@ -28,6 +35,19 @@ describe('allLocalSpecs', () => {
})
})

const testClientSteps: ClientSteps = [
{
lifecycle: 'deploy',
steps: [
{
id: 'copy_static',
name: 'Copy static assets',
type: 'copy_static_assets',
},
],
},
]

describe('createContractBasedModuleSpecification', () => {
test('creates a specification with the given identifier', () => {
// When
Expand All @@ -48,6 +68,62 @@ describe('createContractBasedModuleSpecification', () => {
)
expect(got.appModuleFeatures()).toEqual(['localization'])
})

test('passes clientSteps through to the created specification', () => {
// When
const got = createContractBasedModuleSpecification({
identifier: 'channel_config',
uidStrategy: 'uuid',
experience: 'extension',
appModuleFeatures: () => [],
clientSteps: testClientSteps,
})

// Then
expect(got.clientSteps).toEqual(testClientSteps)
})

test('clientSteps is undefined when not provided', () => {
// When
const got = createContractBasedModuleSpecification({
identifier: 'test',
uidStrategy: 'uuid',
experience: 'extension',
appModuleFeatures: () => [],
})

// Then
expect(got.clientSteps).toBeUndefined()
})
})

describe('createExtensionSpecification', () => {
test('passes clientSteps through to the created specification', () => {
// When
const got = createExtensionSpecification({
identifier: 'test_extension',
appModuleFeatures: () => [],
clientSteps: testClientSteps,
})

// Then
expect(got.clientSteps).toEqual(testClientSteps)
})
})

describe('createConfigExtensionSpecification', () => {
test('passes clientSteps through to the created specification', () => {
// When
const got = createConfigExtensionSpecification({
identifier: 'test_config',
schema: BaseSchema,
transformConfig: {},
clientSteps: testClientSteps,
})

// Then
expect(got.clientSteps).toEqual(testClientSteps)
})
})

describe('configWithoutFirstClassFields', () => {
Expand Down
Loading