Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli committed Jul 4, 2022
1 parent 8111f42 commit a3f9781
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions libs/server/src/lib/utils/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ describe('utils', () => {
options: Schema['properties'],
required: string[] = []
): Promise<Option[]> => {
const r = await normalizeSchema({
properties: { ...options },
required,
});
const r = await normalizeSchema(
{
properties: { ...options },
required,
},
'nx'
);
return r;
};

Expand All @@ -41,28 +44,34 @@ describe('utils', () => {
});

it('should sort positional arguments by ascending order', async () => {
const r = await normalizeSchema({
properties: {
a: { $default: { $source: 'argv', index: 0 } },
b: { $default: { $source: 'argv', index: 2 } },
c: { $default: { $source: 'argv', index: 1 } },
const r = await normalizeSchema(
{
properties: {
a: { $default: { $source: 'argv', index: 0 } },
b: { $default: { $source: 'argv', index: 2 } },
c: { $default: { $source: 'argv', index: 1 } },
},
required: [],
},
required: [],
});
'nx'
);
expect(r.map((x) => x.name)).toEqual(['a', 'c', 'b']);
});

it('should sort required arguments', async () => {
const r = await normalizeSchema({
properties: {
a: { $default: { $source: 'argv', index: 1 } },
b: {},
c: {},
d: { $default: { $source: 'argv', index: 0 } },
e: {},
const r = await normalizeSchema(
{
properties: {
a: { $default: { $source: 'argv', index: 1 } },
b: {},
c: {},
d: { $default: { $source: 'argv', index: 0 } },
e: {},
},
required: ['c', 'e'],
},
required: ['c', 'e'],
});
'nx'
);
expect(r.map((x) => x.name)).toMatchInlineSnapshot(`
Array [
"d",
Expand Down

0 comments on commit a3f9781

Please sign in to comment.