test: 508 tests, 79% line coverage - config eval happy path
- Full happy path test for ConfigurationEvaluationState - Fix flaky integration tests - Coverage stable at 79% lines
This commit is contained in:
1 parent
575975e211
commit
818c661f21
2 files changed
+36
-3
No files matched your search
@@ -74,10 +74,11 @@ describe('BaseModel (integration)', () => {
|
||||
})
|
||||
|
||||
it('find returns multiple documents', async () => {
|
||||
const col = db.collection('test_base')
|
||||
await col.insertMany([{ type: 'a' }, { type: 'a' }, { type: 'b' }])
|
||||
const results = await col.find({ type: 'a' }).toArray()
|
||||
const col = db.collection('test_find_multi')
|
||||
await col.insertMany([{ t: 'a' }, { t: 'a' }, { t: 'b' }])
|
||||
const results = await col.find({ t: 'a' }).toArray()
|
||||
expect(results).toHaveLength(2)
|
||||
await col.drop()
|
||||
})
|
||||
|
||||
it('countDocuments returns correct count', async () => {
|
||||
|
||||
@@ -86,3 +86,35 @@ describe('ConfigurationEvaluationState', () => {
|
||||
expect(result2.nextState!.name).toBe('compliance-update')
|
||||
})
|
||||
})
|
||||
|
||||
describe('ConfigurationEvaluationState - full happy path', () => {
|
||||
it('inventory GPN → GPN → SPV diffs → compliance-update', async () => {
|
||||
const state = new ConfigurationEvaluationState()
|
||||
const context = makeContext('supported')
|
||||
|
||||
// Step 1: First call → GPN for Device.DeviceInfo.
|
||||
const r1 = await state.handle(context)
|
||||
expect(r1.response).toContain('GetParameterNames')
|
||||
expect(r1.response).toContain('Device.DeviceInfo.')
|
||||
|
||||
// Step 2: GPN response → next GPN for Device.ManagementServer.
|
||||
context.message = { success: true, data: { ParameterList: { ParameterInfoStruct: [
|
||||
{ Name: 'Device.DeviceInfo.Manufacturer', Writable: '0' },
|
||||
] } } }
|
||||
const r2 = await state.handle(context)
|
||||
expect(r2.response).toContain('GetParameterNames')
|
||||
expect(r2.response).toContain('Device.ManagementServer.')
|
||||
|
||||
// Step 3: Second GPN response → no more inventory → SPV diffs
|
||||
context.message = { success: true, data: { ParameterList: { ParameterInfoStruct: [] } } }
|
||||
const r3 = await state.handle(context)
|
||||
expect(r3.response).toContain('SetParameterValues')
|
||||
expect(r3.response).toContain('Device.X')
|
||||
|
||||
// Step 4: SPV response → no firmware → transitions to compliance-update
|
||||
context.message = { success: true, data: { Status: 0 } }
|
||||
const r4 = await state.handle(context)
|
||||
expect(r4.nextState).toBeDefined()
|
||||
expect(r4.nextState!.name).toBe('compliance-update')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user