Skip to content

Commit d42af2e

Browse files
committed
fix: update tests for statusPage handler addition
- Add statusPage to ALL_HANDLED_TYPES, metadata, refKey, deletePath tests - Update allHandlers count from 9 to 10 - Add STATUS_PAGES to CLI_RESOURCE_CONFIGS in parity test - Fix applier test: isDefault should be null, not undefined Made-with: Cursor
1 parent 3d65ce6 commit d42af2e

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

test/yaml/applier.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ describe('applier', () => {
257257
expect(result.succeeded).toHaveLength(1)
258258
expect(mockPut).toHaveBeenCalledWith('/api/v1/environments/{slug}', {
259259
params: {path: {slug: 'prod'}},
260-
body: {name: 'Prod', variables: {KEY: 'val'}, isDefault: undefined},
260+
body: {name: 'Prod', variables: {KEY: 'val'}, isDefault: null},
261261
})
262262
})
263263

test/yaml/handlers.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {YAML_SECTION_KEYS} from '../../src/lib/yaml/schema.js'
1313
const ALL_HANDLED_TYPES: HandledResourceType[] = [
1414
'tag', 'environment', 'secret', 'alertChannel',
1515
'notificationPolicy', 'webhook', 'resourceGroup',
16-
'monitor', 'dependency',
16+
'monitor', 'dependency', 'statusPage',
1717
]
1818

1919
describe('handler registry', () => {
@@ -31,9 +31,9 @@ describe('handler registry', () => {
3131
}
3232
})
3333

34-
it('allHandlers returns all 9 handlers', () => {
34+
it('allHandlers returns all 10 handlers', () => {
3535
const handlers = allHandlers()
36-
expect(handlers).toHaveLength(9)
36+
expect(handlers).toHaveLength(10)
3737
const types = new Set(handlers.map((h) => h.resourceType))
3838
for (const type of ALL_HANDLED_TYPES) {
3939
expect(types.has(type), `allHandlers() missing ${type}`).toBe(true)
@@ -67,6 +67,7 @@ describe('handler metadata', () => {
6767
['resourceGroup', 'resourceGroups', 'resourceGroups', '/api/v1/resource-groups'],
6868
['monitor', 'monitors', 'monitors', '/api/v1/monitors'],
6969
['dependency', 'dependencies', 'dependencies', '/api/v1/service-subscriptions'],
70+
['statusPage', 'statusPages', 'statusPages', '/api/v1/status-pages'],
7071
] as const)('%s → refType=%s, configKey=%s, listPath=%s', (type, refType, configKey, listPath) => {
7172
const h = getHandler(type)
7273
expect(h.refType).toBe(refType)
@@ -85,6 +86,7 @@ describe('handler getRefKey', () => {
8586
it('resourceGroup uses name', () => expect(getHandler('resourceGroup').getRefKey({name: 'API'})).toBe('API'))
8687
it('monitor uses name', () => expect(getHandler('monitor').getRefKey({name: 'M'})).toBe('M'))
8788
it('dependency uses service slug', () => expect(getHandler('dependency').getRefKey({service: 'gh'})).toBe('gh'))
89+
it('statusPage uses slug', () => expect(getHandler('statusPage').getRefKey({slug: 'my-page', name: 'My Page'})).toBe('my-page'))
8890
})
8991

9092
describe('handler getApiRefKey + getApiId', () => {
@@ -125,6 +127,7 @@ describe('handler deletePath', () => {
125127
['resourceGroup', '/api/v1/resource-groups/id-1'],
126128
['monitor', '/api/v1/monitors/id-1'],
127129
['dependency', '/api/v1/service-subscriptions/id-1'],
130+
['statusPage', '/api/v1/status-pages/id-1'],
128131
] as const)('%s → %s', (type, expectedPath) => {
129132
expect(getHandler(type).deletePath('id-1', 'ref-1')).toBe(expectedPath)
130133
})

test/yaml/parity.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const CLI_RESOURCE_CONFIGS = [
2121
{config: resources.WEBHOOKS, yamlKey: 'webhooks'},
2222
{config: resources.API_KEYS, yamlKey: null},
2323
{config: resources.DEPENDENCIES, yamlKey: 'dependencies'},
24+
{config: resources.STATUS_PAGES, yamlKey: 'statusPages'},
2425
] as const
2526

2627
describe('CLI ↔ YAML parity', () => {

0 commit comments

Comments
 (0)