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:
Maurice
2026-10-22 22:43:48 +00:00
parent 3b9edc3a90
commit 6c4d743259
5 changed files with 34 additions and 20 deletions
+4 -1
View File
@@ -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.