Files
morning-report/test/sequencer.test.ts
Cory Sanin 8f8819276f
All checks were successful
NPM Audit Check / Check NPM audit (push) Successful in -2m17s
Unit tests / Unit tests (push) Successful in -2m10s
switch out weather library
2025-08-29 01:37:02 -05:00

44 lines
1.3 KiB
TypeScript

import { describe, expect, it, vi, beforeEach } from 'vitest';
import { type CurrentWeather, type Options } from 'openweather-api-node';
import { Sequencer } from '../src/sequencer.js';
import type { Config } from '../src/index.js';
const dummyWeather: Options = { key: 'dummy' };
vi.mock('openweather-api-node', () => {
return {
OpenWeatherAPI: vi.fn().mockImplementation((_) => {
return {
getCurrent: vi.fn(() => {})
}
})
}
});
describe('sequencer', () => {
it('can generate a list from a static config', async () => {
expect(await Sequencer({
programs: [['sequence 1', 'segment 1', 'segment 2']],
segments: {
'segment 1': ['sequence 1'],
'segment 2': ['sequence 2']
},
sequences: {
'sequence 1': {
'tracks': [
'seq1.flac'
]
},
'sequence 2': {
'tracks': [
'seq2.flac'
]
}
},
voices: {},
weather: dummyWeather
})).to.include.ordered.members(['seq1.flac', 'seq1.flac', 'seq2.flac']);
});
});