Skip to content

Commit f1be8df

Browse files
committed
test: update unit tests
1 parent f5a54a7 commit f1be8df

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
import { createField } from './create-field';
2+
import { StringConstraints } from '../string-field';
23

34
describe('createField()', () => {
45
it('should return expected field shape when specified a valid argument', () => {
56
const type = 'string';
6-
const name = 'fieldName';
7+
const name = 'field';
78

89
// Supplied constraints object.
9-
const constraints = { minLength: 0 };
10+
const constraints: StringConstraints = { minLength: 0, scalar: 'string' };
1011

1112
// Supplied create field options.
1213
const options = { pluralName: 'fields' };
1314

14-
expect(createField(type, name, constraints, options)).toEqual({
15+
const result = createField(type, name, constraints, options);
16+
17+
expect(result).toEqual({
1518
type,
1619
name,
20+
scalar: 'string',
1721
pluralName: 'fields',
1822
minLength: 0,
1923
});
2024
});
2125

2226
it('should generate a plural of the provided name', () => {
23-
expect(createField('string', 'name', {}, {}).pluralName).toBe('names');
27+
const type = 'string';
28+
const name = 'field';
29+
30+
// Supplied constraints object.
31+
const constraints: StringConstraints = { scalar: 'string' };
32+
33+
const result = createField(type, name, constraints);
34+
35+
expect(result.pluralName).toEqual('fields');
2436
});
2537
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "MIT",
1010
"scripts": {
11-
"build": "nx run-many --all --target=build",
11+
"build": "nx run-many --all --target=build --exclude examples-api-prisma",
1212
"depcheck": "ts-node -P ./tools/scripts/tsconfig.scripts.json ./tools/scripts/depcheck",
1313
"format": "nx format:write --all",
1414
"pregenerate": "./tools/npm-scripts/pregenerate.sh",

0 commit comments

Comments
 (0)