mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-01 06:53:11 +02:00
faker: render Date outputs as ISO strings
This commit is contained in:
@@ -9,4 +9,18 @@ describe('template-function-faker', () => {
|
||||
// accidental additions, removals, or renames across faker upgrades.
|
||||
expect(names).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders date results as unquoted ISO strings', async () => {
|
||||
const { plugin } = await import('../src/index');
|
||||
const fn = plugin.templateFunctions?.find((fn) => fn.name === 'faker.date.future');
|
||||
|
||||
expect(fn?.onRender).toBeTypeOf('function');
|
||||
|
||||
const result = await fn!.onRender!(
|
||||
{} as Parameters<NonNullable<typeof fn.onRender>>[0],
|
||||
{ values: {} } as Parameters<NonNullable<typeof fn.onRender>>[1],
|
||||
);
|
||||
|
||||
expect(result).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user