mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 02:14:05 +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:
@@ -78,7 +78,7 @@ function setup(fakes: Fakes = {}) {
|
||||
books as unknown as JourneyBookEditService,
|
||||
photos as unknown as JourneyAiPhotosService,
|
||||
registry,
|
||||
orm,
|
||||
orm.orm,
|
||||
);
|
||||
const stop = new AbortController();
|
||||
const asked: AssistantPageRender[] = [];
|
||||
|
||||
@@ -70,12 +70,13 @@ function book(): BookDocument {
|
||||
return blankBook({ title: 'Lisbon', newId: (prefix) => `${prefix}-${++seq}` });
|
||||
}
|
||||
|
||||
/** The base a turn's gate tries a call on, as `trialBase` reads it: a journey without a book has no version. */
|
||||
function input(doc: BookDocument | null = book()): BookTrialInput {
|
||||
let seq = 0;
|
||||
return {
|
||||
journeyId: 4,
|
||||
doc,
|
||||
version: 3,
|
||||
version: doc ? 3 : null,
|
||||
ctx: {
|
||||
photos: [{ photoId: 81 }, { photoId: 82 }],
|
||||
journey: { title: 'Lisbon' },
|
||||
|
||||
@@ -23,12 +23,13 @@ function webp(chunk: string, length: number): Buffer {
|
||||
|
||||
describe('readImageHeader', () => {
|
||||
it('IMGHDR-001: steps over stray bytes, fill bytes and the markers that carry no length', () => {
|
||||
// A JPEG opens with SOI and a marker (FF D8 FF); the stray bytes come between segments, after the first one.
|
||||
const segments = [
|
||||
[0xff, 0xe1, 0x00, 0x04, 0, 0],
|
||||
[0x00, 0x12],
|
||||
[0xff, 0xff],
|
||||
[0xff, 0x01],
|
||||
[0xff, 0xd0],
|
||||
[0xff, 0xe1, 0x00, 0x04, 0, 0],
|
||||
];
|
||||
expect(readImageHeader(jpeg(800, 600, ...segments))).toEqual({ mimeType: 'image/jpeg', width: 800, height: 600 });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user