- Domain: DeviceId, Command, DeviceParameter, DeviceProperty, Mode - Protocol: SOAP parsing, CWMPMessageBuilder (all methods) - References: config_loader, WassupProvider (timeout, errors) - Integration: MongoDB tests (CRUD, pagination, references) - Fix: Home.vue IP lookup for Device.WANDevice path - Total: 384 tests passing
27 lines
965 B
TypeScript
27 lines
965 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { loadReferencesConfig, reloadReferencesConfig } from '../../../../app/services/references/config_loader.js'
|
|
|
|
describe('config_loader', () => {
|
|
it('loadReferencesConfig loads config from file', () => {
|
|
const config = loadReferencesConfig()
|
|
expect(config).toBeDefined()
|
|
expect(config.providers).toBeInstanceOf(Array)
|
|
expect(config.providers.length).toBeGreaterThan(0)
|
|
expect(config.providers[0].name).toBe('wassup')
|
|
})
|
|
|
|
it('loadReferencesConfig returns cached result on second call', () => {
|
|
const a = loadReferencesConfig()
|
|
const b = loadReferencesConfig()
|
|
expect(a).toBe(b) // same reference (cached)
|
|
})
|
|
|
|
it('reloadReferencesConfig clears cache and reloads', () => {
|
|
const a = loadReferencesConfig()
|
|
const b = reloadReferencesConfig()
|
|
expect(b.providers).toBeInstanceOf(Array)
|
|
// After reload, a new object is returned
|
|
expect(b).not.toBe(a)
|
|
})
|
|
})
|