Skip to content

Commit cc0d521

Browse files
committed
test: update tests
1 parent a80c608 commit cc0d521

File tree

8 files changed

+22
-20
lines changed

8 files changed

+22
-20
lines changed

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
"url": "http://gajus.com"
66
},
77
"ava": {
8+
"babel": {
9+
"compileAsTests": [
10+
"test/helpers/**/*"
11+
]
12+
},
813
"files": [
9-
"test/**/*"
10-
],
11-
"helpers": [
12-
"test/helpers/**/*"
14+
"test/postloader/**/*"
1315
],
1416
"require": [
1517
"@babel/register"
16-
],
17-
"sources": [
18-
"src/**/*"
1918
]
2019
},
2120
"bin": "./dist/bin/index.js",
@@ -30,6 +29,7 @@
3029
},
3130
"description": "A scaffolding tool for projects using DataLoader, Flow and PostgreSQL.",
3231
"devDependencies": {
32+
"@ava/babel": "^1.0.1",
3333
"@babel/cli": "^7.10.1",
3434
"@babel/core": "^7.10.2",
3535
"@babel/node": "^7.10.1",

test/postloader/utilities/createColumnSelector.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('creates multiple column selector', (t) => {
1212
createColumnWithName('bar_baz'),
1313
]);
1414

15-
t.true(columnSelector === '"foo", "bar_baz" "barBaz"');
15+
t.is(columnSelector, '"foo", "bar_baz" "barBaz"');
1616
});
1717

1818
test('creates multiple column selector using an alias', (t) => {
@@ -21,5 +21,5 @@ test('creates multiple column selector using an alias', (t) => {
2121
createColumnWithName('bar_baz'),
2222
], 't1');
2323

24-
t.true(columnSelector === 't1."foo", t1."bar_baz" "barBaz"');
24+
t.is(columnSelector, 't1."foo", t1."bar_baz" "barBaz"');
2525
});

test/postloader/utilities/createLoaderTypePropertyDeclaration.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ import test from 'ava';
44
import createLoaderTypePropertyDeclaration from '../../../src/utilities/createLoaderTypePropertyDeclaration';
55

66
test('generates loader type property declaration', (t) => {
7-
t.true(createLoaderTypePropertyDeclaration('FooLoader', 'text', 'foo', false) === '+FooLoader: DataLoader<string, FooRecordType>');
8-
t.true(createLoaderTypePropertyDeclaration('FooLoader', 'integer', 'foo', false) === '+FooLoader: DataLoader<number, FooRecordType>');
7+
t.is(createLoaderTypePropertyDeclaration('FooLoader', 'text', 'foo', false), '+FooLoader: DataLoader<string, FooRecordType>');
8+
t.is(createLoaderTypePropertyDeclaration('FooLoader', 'integer', 'foo', false), '+FooLoader: DataLoader<number, FooRecordType>');
99
});
1010

1111
test('generates loader type property declaration (array)', (t) => {
12-
t.true(createLoaderTypePropertyDeclaration('FooLoader', 'text', 'foo', true) === '+FooLoader: DataLoader<string, $ReadOnlyArray<FooRecordType>>');
13-
t.true(createLoaderTypePropertyDeclaration('FooLoader', 'integer', 'foo', true) === '+FooLoader: DataLoader<number, $ReadOnlyArray<FooRecordType>>');
12+
t.is(createLoaderTypePropertyDeclaration('FooLoader', 'text', 'foo', true), '+FooLoader: DataLoader<string, $ReadOnlyArray<FooRecordType>>');
13+
t.is(createLoaderTypePropertyDeclaration('FooLoader', 'integer', 'foo', true), '+FooLoader: DataLoader<number, $ReadOnlyArray<FooRecordType>>');
1414
});
1515

1616
test('throws an error if data type cannot resolve to a string or number', (t) => {
1717
t.throws((): void => {
1818
createLoaderTypePropertyDeclaration('FooLoader', 'unknown', 'foo', false);
19-
}, 'Cannot resolve key type.');
19+
}, {
20+
message: 'Cannot resolve key type.',
21+
});
2022
});

test/postloader/utilities/formatPropertyName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import test from 'ava';
44
import formatPropertyName from '../../../src/utilities/formatPropertyName';
55

66
test('camel cases the input', (t) => {
7-
t.true(formatPropertyName('foo bar baz') === 'fooBarBaz');
7+
t.is(formatPropertyName('foo bar baz'), 'fooBarBaz');
88
});

test/postloader/utilities/formatTypeName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import test from 'ava';
44
import formatTypeName from '../../../src/utilities/formatTypeName';
55

66
test('pascal cases input and appends RecordType', (t) => {
7-
t.true(formatTypeName('foo bar baz') === 'FooBarBazRecordType');
7+
t.is(formatTypeName('foo bar baz'), 'FooBarBazRecordType');
88
});

test/postloader/utilities/generateFlowTypeDocument.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type {
2626
BarRecordType
2727
};`);
2828

29-
t.true(actual === expected);
29+
t.is(actual, expected);
3030
});
3131

3232
test('create flow type document with multiple types', (t) => {
@@ -55,5 +55,5 @@ export type {
5555
QuxRecordType
5656
};`);
5757

58-
t.true(actual === expected);
58+
t.is(actual, expected);
5959
});

test/postloader/utilities/getFlowType.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ test('correctly maps known types', (t) => {
2424
throw new TypeError('Unexpected type');
2525
}
2626

27-
t.true(getFlowType(databaseTypeName) === flowType, flowType);
27+
t.is(getFlowType(databaseTypeName), flowType, flowType);
2828
}
2929
});

test/postloader/utilities/isJoiningTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ test('correctly recognizes not a joining table', (t) => {
3939
],
4040
);
4141

42-
t.true(!tableIsJoining);
42+
t.false(tableIsJoining);
4343
});

0 commit comments

Comments
 (0)