Add Enable Dynamic Audio option to schedule blocks
This commit is contained in:
@@ -63,6 +63,7 @@ describe('schedule load', () => {
|
||||
id: 'b1',
|
||||
startMinutes: 360,
|
||||
endMinutes: 480,
|
||||
dynamicAudio: true,
|
||||
proclamations: [
|
||||
{
|
||||
proclamation: {
|
||||
@@ -78,9 +79,14 @@ describe('schedule load', () => {
|
||||
]);
|
||||
|
||||
const result = (await load({ locals } as never)) as {
|
||||
blocks: { id: string; proclamations: Record<string, unknown>[] }[];
|
||||
blocks: {
|
||||
id: string;
|
||||
dynamicAudio: boolean;
|
||||
proclamations: Record<string, unknown>[];
|
||||
}[];
|
||||
};
|
||||
|
||||
expect(result.blocks[0].dynamicAudio).toBe(true);
|
||||
expect(result.blocks[0].proclamations[0]).toEqual({
|
||||
id: 'p1',
|
||||
name: 'Peace',
|
||||
@@ -127,7 +133,8 @@ describe('schedule actions', () => {
|
||||
request: createFormRequest({
|
||||
startMinutes: '360',
|
||||
endMinutes: '480',
|
||||
proclamationIds: JSON.stringify(['p1', 'p2'])
|
||||
proclamationIds: JSON.stringify(['p1', 'p2']),
|
||||
dynamicAudio: 'true'
|
||||
}),
|
||||
locals
|
||||
} as never);
|
||||
@@ -136,10 +143,29 @@ describe('schedule actions', () => {
|
||||
expect(createBlockMock).toHaveBeenCalledWith('user-1', {
|
||||
startMinutes: 360,
|
||||
endMinutes: 480,
|
||||
proclamationIds: ['p1', 'p2']
|
||||
proclamationIds: ['p1', 'p2'],
|
||||
dynamicAudio: true
|
||||
});
|
||||
});
|
||||
|
||||
it('createBlock defaults dynamic audio to false when the field is absent', async () => {
|
||||
createBlockMock.mockResolvedValue({ ok: true, id: 'b1' });
|
||||
|
||||
await actions.createBlock!({
|
||||
request: createFormRequest({
|
||||
startMinutes: '360',
|
||||
endMinutes: '480',
|
||||
proclamationIds: JSON.stringify(['p1'])
|
||||
}),
|
||||
locals
|
||||
} as never);
|
||||
|
||||
expect(createBlockMock).toHaveBeenCalledWith(
|
||||
'user-1',
|
||||
expect.objectContaining({ dynamicAudio: false })
|
||||
);
|
||||
});
|
||||
|
||||
it('deleteBlock returns not found without an id', async () => {
|
||||
const result = await actions.deleteBlock!({
|
||||
request: createFormRequest({}),
|
||||
|
||||
Reference in New Issue
Block a user