Skip to content

Commit

Permalink
Update path test for regex era
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Sep 11, 2024
1 parent faa8379 commit 3d1453a
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions src/schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import test from 'node:test';
import { throws } from 'node:assert';
import assert, { throws } from 'node:assert';
import { Durationable, Options } from './schema.ts';
import { Temporal } from 'temporal-polyfill';
import { durationEqual, optionsEqual } from './assert.ts';
import { z } from 'zod';
import { deepStrictEqual } from 'node:assert/strict';

const defaultOptions = Object.freeze({
isEarlyExit: true,
Expand Down Expand Up @@ -119,9 +121,21 @@ test('Options reject invalid values', () => {
...defaultOptions,
waitList: [{ workflowFile: 'ci.toml' }],
}),
{
name: 'ZodError',
message: /Invalid input: must end with/,
(err) => {
assert(err instanceof z.ZodError);
deepStrictEqual(err.issues, [
{
code: 'invalid_string',
message: 'Invalid',
path: [
'waitList',
0,
'workflowFile',
],
validation: 'regex',
},
]);
return true;
},
);

Expand All @@ -131,9 +145,21 @@ test('Options reject invalid values', () => {
...defaultOptions,
waitList: [{ workflowFile: 'ciyaml' }],
}),
{
name: 'ZodError',
message: /Invalid input: must end with/,
(err) => {
assert(err instanceof z.ZodError);
deepStrictEqual(err.issues, [
{
code: 'invalid_string',
message: 'Invalid',
path: [
'waitList',
0,
'workflowFile',
],
validation: 'regex',
},
]);
return true;
},
);
});
Expand Down

0 comments on commit 3d1453a

Please sign in to comment.