-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improve overall test coverage (#287)
* test: improve overall test coverage * style: consistent descriptions in freezeable tests * test: add more unit tests * test: add more unit tests * test: complete test coverage for utils * refactor: do not rely on global mocha functions * test: add unit test for jsonapi, serializer, and more * test: add unit tests for Router and Config * test: start adding fs unit tests * test: add unit tests for loader * add unit test for fs#exists * test: add unit test for fs#rmrf * test: add unit tests for Logger * test: add initial Route unit tests * test: add unit tests for route utils * test: add unit test for filter-param * fix: get tests passing on windows * fix: ensure tmp dir exists on appveyor builds * test: get tests to pass after merge * test: use social-network as test-app * fix: get unit tests passing and remove integration tests for now * test: add unit test for route parameters * refactor: change test-app name back to test-app * test: add unit test for route parameter groups * test: add unit test for route action * test: start unit test for controller * test: complete unit test for controller * fix: use bcryptjs instead of bcrypt-as-promised in test-app * test: add unit test for database validations * fix: use relative paths in test-app until rollup aliases are fixed * fix: use relative file path for windows in test-app * fix: replace remaining aliased file paths in test-app * fix: create root tmp dir in appveyor before running tests * test: increase mocha timeout * test: add unit tests for server/request and server/response * test: use local timeout in root before hook * test: add unit tests for server/responder and server * refactor: run tests without building * test: add unit tests to fs - adds sinon as dev-dep for mocking and spying native node fs modules - refactor fs test setup and cleanup utils into shared modules - adds test coverage for lux fs delegation and promise-wrapping * test: add unit tests for database and static methods of database/model * test: add unit tests in model for #save() and #update() * test: add remaining unit test for model instance methods * test: improve #save() unit test for model * test: add unit tests for model hooks * test: add unit test for migration * test: add unit test for static methods of database/query * test: normalize test naming conventions * test: improve unit test for .from() in database/query * test: add codecov integration * test: begin adding unit test for database/query instance methods * test: add unit test for logger #line() * test: do not include custom errors in test coverage * test: add unit tests for query instance methods and properly extend Promise * fix: use valid integer to prevent postgres errors in controller test * fix: do not user deep equal for query #include() include unit tests
- Loading branch information
1 parent
cd1e822
commit 4d35d59
Showing
183 changed files
with
8,292 additions
and
1,526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
# compiled output | ||
dist/* | ||
coverage/ | ||
dist/ | ||
.nyc_output/ | ||
|
||
# tests | ||
test/* | ||
test/ | ||
|
||
# docs | ||
docs/* | ||
docs/ | ||
|
||
# dependencies | ||
node_modules/* | ||
node_modules/ | ||
|
||
# misc | ||
decl/* | ||
examples/* | ||
decl/ | ||
examples/ | ||
*interfaces.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
# dependencies | ||
/node_modules | ||
node_modules/ | ||
|
||
# misc | ||
.git | ||
*.DS_Store | ||
/examples | ||
*.lcov | ||
.nyc_output/ | ||
coverage/ | ||
examples/ | ||
|
||
# docs | ||
/docs | ||
docs/ | ||
|
||
# logs | ||
/log | ||
log/ | ||
npm-debug.log | ||
|
||
# tests | ||
/test | ||
test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
//@flow | ||
// src: github.com/flowtype/flow-typed/tree/master/definitions/npm/chai_v3.5.x | ||
declare module 'chai' { | ||
declare type ExpectChain<T> = { | ||
and: ExpectChain<T>; | ||
at: ExpectChain<T>; | ||
be: ExpectChain<T>; | ||
been: ExpectChain<T>; | ||
have: ExpectChain<T>; | ||
has: ExpectChain<T>; | ||
is: ExpectChain<T>; | ||
of: ExpectChain<T>; | ||
same: ExpectChain<T>; | ||
that: ExpectChain<T>; | ||
to: ExpectChain<T>; | ||
which: ExpectChain<T>; | ||
with: ExpectChain<T>; | ||
|
||
not: ExpectChain<T>; | ||
deep: ExpectChain<T>; | ||
any: ExpectChain<T>; | ||
all: ExpectChain<T>; | ||
|
||
a: ExpectChain<T> & (type: string) => ExpectChain<T>; | ||
an: ExpectChain<T> & (type: string) => ExpectChain<T>; | ||
|
||
frozen: ExpectChain<T> & (value: mixed) => ExpectChain<T>; | ||
sealed: ExpectChain<T> & (value: mixed) => ExpectChain<T>; | ||
include: ExpectChain<T> & (value: mixed) => ExpectChain<T>; | ||
includes: ExpectChain<T> & (value: mixed) => ExpectChain<T>; | ||
contain: ExpectChain<T> & (value: mixed) => ExpectChain<T>; | ||
contains: ExpectChain<T> & (value: mixed) => ExpectChain<T>; | ||
|
||
eql: (value: T) => ExpectChain<T>; | ||
equal: (value: T) => ExpectChain<T>; | ||
equals: (value: T) => ExpectChain<T>; | ||
|
||
above: (value: T & number) => ExpectChain<T>; | ||
least: (value: T & number) => ExpectChain<T>; | ||
below: (value: T & number) => ExpectChain<T>; | ||
most: (value: T & number) => ExpectChain<T>; | ||
within: (start: T & number, finish: T & number) => ExpectChain<T>; | ||
|
||
instanceof: (constructor: mixed) => ExpectChain<T>; | ||
|
||
property: ( | ||
<P>(name: string, value?: P) => ExpectChain<P> | ||
& (name: string) => ExpectChain<mixed> | ||
); | ||
|
||
length: ExpectChain<number>; | ||
lengthOf: (value: number) => ExpectChain<T>; | ||
|
||
match: (regex: RegExp) => ExpectChain<T>; | ||
string: (string: string) => ExpectChain<T>; | ||
|
||
key: (key: string) => ExpectChain<T>; | ||
|
||
keys: ( | ||
key: string | Array<string>, | ||
...keys: Array<string> | ||
) => ExpectChain<T>; | ||
|
||
throw: <E>( | ||
err: Class<E> | Error | RegExp | string, | ||
msg?: RegExp | string | ||
) => ExpectChain<T>; | ||
|
||
respondTo: (method: string) => ExpectChain<T>; | ||
itself: ExpectChain<T>; | ||
|
||
satisfy: (method: (value: T) => bool) => ExpectChain<T>; | ||
|
||
closeTo: (expected: T & number, delta: number) => ExpectChain<T>; | ||
|
||
members: (set: mixed) => ExpectChain<T>; | ||
oneOf: (list: Array<T>) => ExpectChain<T>; | ||
|
||
change: (obj: mixed, key: string) => ExpectChain<T>; | ||
increase: (obj: mixed, key: string) => ExpectChain<T>; | ||
decrease: (obj: mixed, key: string) => ExpectChain<T>; | ||
|
||
// dirty-chai | ||
ok: () => ExpectChain<T>; | ||
true: () => ExpectChain<T>; | ||
false: () => ExpectChain<T>; | ||
null: () => ExpectChain<T>; | ||
undefined: () => ExpectChain<T>; | ||
exist: () => ExpectChain<T>; | ||
empty: () => ExpectChain<T>; | ||
|
||
// chai-immutable | ||
size: (n: number) => ExpectChain<T>; | ||
|
||
// sinon-chai | ||
called: () => ExpectChain<T>; | ||
callCount: (n: number) => ExpectChain<T>; | ||
calledOnce: () => ExpectChain<T>; | ||
calledBefore: (spy: mixed) => ExpectChain<T>; | ||
calledAfter: (spy: mixed) => ExpectChain<T>; | ||
calledWith: (...args: Array<mixed>) => ExpectChain<T>; | ||
calledWithMatch: (...args: Array<mixed>) => ExpectChain<T>; | ||
calledWithExactly: (...args: Array<mixed>) => ExpectChain<T>; | ||
}; | ||
|
||
declare function expect<T>(actual: T): ExpectChain<T>; | ||
|
||
declare function use(plugin: (chai: Object, utils: Object) => void): void; | ||
|
||
declare var config: { | ||
includeStack: boolean; | ||
showDiff: boolean; | ||
truncateThreshold: boolean; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// @flow | ||
// src: github.com/flowtype/flow-typed/tree/master/definitions/npm/mocha_v2.4.x | ||
type $npm$mocha$testFunction = (done: () => void) => void | Promise<mixed>; | ||
|
||
declare module 'mocha' { | ||
declare var describe: { | ||
(name: string, spec: () => void): void; | ||
only(description: string, spec: () => void): void; | ||
skip(description: string, spec: () => void): void; | ||
timeout(ms: number): void; | ||
}; | ||
|
||
declare var context: typeof describe; | ||
|
||
declare var it: { | ||
(name: string, spec?: $npm$mocha$testFunction): void; | ||
only(description: string, spec: $npm$mocha$testFunction): void; | ||
skip(description: string, spec: $npm$mocha$testFunction): void; | ||
timeout(ms: number): void; | ||
}; | ||
|
||
declare function before(method: $npm$mocha$testFunction): void; | ||
declare function beforeEach(method: $npm$mocha$testFunction): void; | ||
declare function after(method: $npm$mocha$testFunction): void; | ||
declare function afterEach(method: $npm$mocha$testFunction): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// @flow | ||
declare module 'node-fetch' { | ||
declare var exports: (url: string, options?: { | ||
body?: any; | ||
referrer?: string; | ||
integrity?: string; | ||
|
||
mode?: | ||
| 'cors' | ||
| 'no-cors' | ||
| 'same-origin'; | ||
|
||
cache?: | ||
| 'default' | ||
| 'no-store' | ||
| 'reload' | ||
| 'no-cache' | ||
| 'force-cache' | ||
| 'only-if-cached'; | ||
|
||
method?: | ||
| 'GET' | ||
| 'HEAD' | ||
| 'OPTIONS' | ||
| 'PATCH' | ||
| 'POST' | ||
| 'DELETE'; | ||
|
||
headers?: { | ||
[key: string]: string; | ||
}; | ||
|
||
redirect?: | ||
| 'follow' | ||
| 'manual' | ||
| 'error'; | ||
|
||
credentials?: | ||
| 'omit' | ||
| 'include' | ||
| 'same-origin'; | ||
|
||
referrerPolicy?: | ||
| 'no-referrer' | ||
| 'no-referrer-when-downgrade' | ||
| 'origin' | ||
| 'origin-when-cross-origin' | ||
| 'unsafe-url'; | ||
}) => Promise<{ | ||
status: number; | ||
headers: Map<string, string>; | ||
|
||
text(): Promise<string>; | ||
json(): Promise<Object>; | ||
}>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// @flow | ||
|
||
declare module 'sinon' { | ||
declare type Spy = { | ||
calledWith: (...args: Array<any>) => boolean; | ||
calledOnce: boolean; | ||
restore: () => void; | ||
reset: () => void; | ||
}; | ||
declare function spy(module: Object, method: string): Spy; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
'use strict'; | ||
|
||
// Require this module to use code in the /src dir prior to transpilation. | ||
/*************************************************************************** | ||
* Require this module to use code in the /src dir prior to transpilation. * | ||
***************************************************************************/ | ||
|
||
const plugins = (...items) => items.concat([ | ||
'syntax-flow', | ||
'syntax-trailing-function-commas', | ||
'transform-async-to-generator', | ||
'transform-class-properties', | ||
'transform-es2015-destructuring', | ||
'transform-es2015-parameters', | ||
'transform-es2015-spread', | ||
'transform-exponentiation-operator', | ||
'transform-flow-strip-types', | ||
'transform-object-rest-spread', | ||
'transform-es2015-modules-commonjs' | ||
]); | ||
|
||
require('babel-register')({ | ||
babelrc: false, | ||
|
||
plugins: [ | ||
'syntax-flow', | ||
'syntax-trailing-function-commas', | ||
'transform-async-to-generator', | ||
'transform-class-properties', | ||
'transform-es2015-destructuring', | ||
'transform-es2015-parameters', | ||
'transform-es2015-spread', | ||
'transform-exponentiation-operator', | ||
'transform-flow-strip-types', | ||
'transform-object-rest-spread', | ||
'transform-es2015-modules-commonjs' | ||
] | ||
plugins: plugins(), | ||
env: { | ||
test: { | ||
sourceMaps: 'inline', | ||
plugins: plugins(['istanbul', { | ||
include: [ | ||
'src/**/*.js' | ||
], | ||
exclude: [ | ||
'**/test', | ||
'**/errors', | ||
'**/interfaces.js' | ||
] | ||
}]) | ||
} | ||
} | ||
}); |
Oops, something went wrong.