mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-25 22:27:32 +00:00
test(assistant): book card tests run in a request context and match a journey without a book
The book card e2e calls the book services inside a request context, the preview expects the design id beside the operations, a trial without a book has no version, the JPEG fixture keeps its signature, and the upload test checks the file name where the client sets it.
This commit is contained in:
@@ -145,6 +145,7 @@ describe('assistantRepo', () => {
|
||||
const image = new Blob(['jpeg'], { type: 'image/jpeg' });
|
||||
const page = { image, bookVersion: 4, spreadId: 'sp-3', drawnPhotoIds: [7, 8] };
|
||||
const signal = new AbortController().signal;
|
||||
const append = vi.spyOn(FormData.prototype, 'append');
|
||||
|
||||
await assistantRepo.uploadRender(12, 9, 'req-1', page, signal);
|
||||
await expect(assistantRepo.pageBook(12)).resolves.toBeNull();
|
||||
@@ -152,9 +153,11 @@ describe('assistantRepo', () => {
|
||||
await expect(assistantRepo.pageDraft(12, 'd-1')).resolves.toEqual({ version: 0, document: DRAFT });
|
||||
|
||||
expect(requestId).toBe('req-1');
|
||||
// One file part; jsdom names every file part 'blob' on the wire, so its name is checked where the form gets it.
|
||||
expect(append).toHaveBeenCalledWith('image', image, 'page.jpg');
|
||||
expect(sent).toEqual({
|
||||
fields: { bookVersion: '4', spreadId: 'sp-3', drawnPhotoIds: '7,8' },
|
||||
filenames: ['page.jpg'],
|
||||
filenames: [expect.any(String)],
|
||||
});
|
||||
|
||||
// Online only, like every other call here.
|
||||
|
||||
Reference in New Issue
Block a user