@o3r/testing
Version:
The module provides testing (e2e, unit test) utilities to help you build your own E2E pipeline integrating visual testing.
39 lines • 1.76 kB
TypeScript
import type { IMock } from '@amadeus-it-group/kassette';
import { Temporal } from 'temporal-polyfill';
/**
* Options to be passed to `updateDatesInMocks`
*/
export interface UpdateDatesInMocksOptions {
/**
* 'any': dates in inputs will be ignored when computing checksum, the dates on the output will be updated to keep the same day offset
* 'day-offset': dates in inputs will be converted to day offsets, the dates on the output will be updated to keep the same day offset
* 'same-day-of-week': dates in inputs will be converted to day of week, the dates on the output will be updated to keep the same day of week but increment the week
*/
mode: 'any' | 'day-offset' | 'same-day-of-week';
/**
* RegExp used to extract dates from request and response
*/
extractor: RegExp;
/**
* Functions to be used to convert from Temporal objects to strings, and strings to temporal objects
*/
converter: {
/**
* Converter from Temporal to string
* @param input
*/
fromDate: (input: Temporal.ZonedDateTime | Temporal.PlainDate) => string;
/**
* Converter from string to Temporal
* @param input
*/
toDate: (input: string) => Temporal.ZonedDateTime | Temporal.PlainDate;
};
}
/**
* Update mock checksum and response body to keep using the same mocks every day with updated dates
* @param mock the mock instance provided by the hook method of Kassette
* @param inputOptions default options will extract ISO strings and use 'day-offset' mode
*/
export declare function updateDatesInMocks(mock: IMock, inputOptions?: Partial<UpdateDatesInMocksOptions>): Promise<void>;
//# sourceMappingURL=update-dates-in-mocks.d.ts.map