-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from mediachain/yn-test-all-the-things
Boost test coverage
- Loading branch information
Showing
40 changed files
with
2,209 additions
and
374 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,3 +1,8 @@ | ||
{ | ||
"plugins": ["transform-flow-strip-types"] | ||
"plugins": ["transform-flow-strip-types"], | ||
"env": { | ||
"test": { | ||
"plugins": ["transform-flow-strip-types", "istanbul"] | ||
} | ||
} | ||
} |
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,192 @@ | ||
// flow-typed signature: 9e3d57d259619cd3fcf8c7c3eced99f5 | ||
// flow-typed version: 60acee2512/chai_v3.5.x/flow_>=v0.24.0 | ||
|
||
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>, | ||
|
||
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: (value: number) => ExpectChain<T> | 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>, | ||
|
||
// chai-as-promised | ||
eventually: () => ExpectChain<T> | ||
}; | ||
|
||
declare function expect<T>(actual: T): ExpectChain<T>; | ||
|
||
declare function use(plugin: (chai: Object, utils: Object) => void): void; | ||
|
||
declare class assert { | ||
static(expression: mixed, message?: string): void; | ||
static fail(actual: mixed, expected: mixed, message?: string, operator?: string): void; | ||
|
||
static isOk(object: mixed, message?: string): void; | ||
static isNotOk(object: mixed, message?: string): void; | ||
|
||
static equal(actual: mixed, expected: mixed, message?: string): void; | ||
static notEqual(actual: mixed, expected: mixed, message?: string): void; | ||
|
||
static strictEqual(act: mixed, exp: mixed, msg?: string): void; | ||
static notStrictEqual(act: mixed, exp: mixed, msg?: string): void; | ||
|
||
static deepEqual(act: mixed, exp: mixed, msg?: string): void; | ||
static notDeepEqual(act: mixed, exp: mixed, msg?: string): void; | ||
|
||
static isTrue(val: mixed, msg?: string): void; | ||
static isNotTrue(val: mixed, msg?: string): void; | ||
static isFalse(val: mixed, msg?: string): void; | ||
static isNotFalse(val: mixed, msg?: string): void; | ||
|
||
static isNull(val: mixed, msg?: string): void; | ||
static isNotNull(val: mixed, msg?: string): void; | ||
|
||
static isUndefined(val: mixed, msg?: string): void; | ||
static isDefined(val: mixed, msg?: string): void; | ||
|
||
static isNaN(val: mixed, msg?: string): void; | ||
static isNotNaN(val: mixed, msg?: string): void; | ||
|
||
static isAbove(val: number, abv: number, msg?: string): void; | ||
static isBelow(val: number, blw: number, msg?: string): void; | ||
|
||
static isAtMost(val: number, atmst: number, msg?: string): void; | ||
static isAtLeast(val: number, atlst: number, msg?: string): void; | ||
|
||
static isFunction(val: mixed, msg?: string): void; | ||
static isNotFunction(val: mixed, msg?: string): void; | ||
|
||
static isObject(val: mixed, msg?: string): void; | ||
static isNotObject(val: mixed, msg?: string): void; | ||
|
||
static isArray(val: mixed, msg?: string): void; | ||
static isNotArray(val: mixed, msg?: string): void; | ||
|
||
static isString(val: mixed, msg?: string): void; | ||
static isNotString(val: mixed, msg?: string): void; | ||
|
||
static isNumber(val: mixed, msg?: string): void; | ||
static isNotNumber(val: mixed, msg?: string): void; | ||
|
||
static isBoolean(val: mixed, msg?: string): void; | ||
static isNotBoolean(val: mixed, msg?: string): void; | ||
|
||
static typeOf(val: mixed, type: string, msg?: string): void; | ||
static notTypeOf(val: mixed, type: string, msg?: string): void; | ||
|
||
static instanceOf(val: mixed, constructor: Function, msg?: string): void; | ||
static notInstanceOf(val: mixed, constructor: Function, msg?: string): void; | ||
|
||
static include(exp: string, inc: mixed, msg?: string): void; | ||
static include(exp: Array<mixed>, inc: mixed, msg?: string): void; | ||
|
||
static notInclude(exp: string, inc: mixed, msg?: string): void; | ||
static notInclude(exp: Array<mixed>, inc: mixed, msg?: string): void; | ||
|
||
static match(exp: mixed, re: RegExp, msg?: string): void; | ||
static notMatch(exp: mixed, re: RegExp, msg?: string): void; | ||
|
||
static property(obj: Object, prop: string, msg?: string): void; | ||
static notProperty(obj: Object, prop: string, msg?: string): void; | ||
static deepProperty(obj: Object, prop: string, msg?: string): void; | ||
static notDeepProperty(obj: Object, prop: string, msg?: string): void; | ||
|
||
static propertyVal(obj: Object, prop: string, val: mixed, msg?: string): void; | ||
static propertyNotVal(obj: Object, prop: string, val: mixed, msg?: string): void; | ||
|
||
static deepPropertyVal(obj: Object, prop: string, val: mixed, msg?: string): void; | ||
static deepPropertyNotVal(obj: Object, prop: string, val: mixed, msg?: string): void; | ||
|
||
static lengthOf(exp: mixed, len: number, msg?: string): void; | ||
} | ||
|
||
declare var config: { | ||
includeStack: boolean, | ||
showDiff: boolean, | ||
truncateThreshold: number | ||
}; | ||
} |
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,6 @@ | ||
// flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 | ||
// flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x | ||
|
||
declare module 'flow-bin' { | ||
declare module.exports: string; | ||
} |
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,164 @@ | ||
// flow-typed signature: 70c5066abfa785637d22983bcc46f142 | ||
// flow-typed version: a3fdaed924/knex_v0.12.x/flow_>=v0.33.x | ||
|
||
declare class Knex$Transaction mixins Knex$QueryBuilder, events$EventEmitter, Promise { | ||
commit(connection?: any, value?: any): Promise<any>; | ||
rollback(): Promise<any>; | ||
savepoint(connection?: any): Promise<any>; | ||
} | ||
|
||
declare type Knex$QueryBuilderFn = (qb: Knex$QueryBuilder) => Knex$QueryBuilder; | ||
|
||
declare class Knex$QueryBuilder mixins Promise { | ||
select(key?: string[]): this; | ||
select(...key: string[]): this; | ||
timeout(ms: number, options?: { cancel: bool }): this; | ||
column(key: string[]): this; | ||
column(...key: string[]): this; | ||
with(alias: string, w: string|Knex$QueryBuilderFn): this; | ||
withSchema(schema: string): this; | ||
returning(column: string): this; | ||
returning(...columns: string[]): this; | ||
returning(columns: string[]): this; | ||
as(name: string): this; | ||
transacting(trx: ?Knex$Transaction): this; | ||
where(builder: Knex$QueryBuilderFn): this; | ||
where(column: string, value: any): this; | ||
where(column: string, operator: string, value: any): this; | ||
whereNot(builder: Knex$QueryBuilderFn): this; | ||
whereNot(column: string, value: any): this; | ||
whereNot(column: string, operator: string, value: any): this; | ||
whereIn(column: string, values: any[]): this; | ||
whereNotIn(column: string, values: any[]): this; | ||
whereNull(column: string): this; | ||
whereNotNull(column: string): this; | ||
whereExists(column: string): this; | ||
whereNotExists(column: string): this; | ||
whereBetween(column: string, range: number[]): this; | ||
whereNotBetween(column: string, range: number[]): this; | ||
whereRaw(raw: any): this; | ||
orWhere(builder: Knex$QueryBuilderFn): this; | ||
orWhere(column: string, value: any): this; | ||
orWhere(column: string, operator: string, value: any): this; | ||
orWhereNot(builder: Knex$QueryBuilderFn): this; | ||
orWhereNot(column: string, value: any): this; | ||
orWhereNot(column: string, operator: string, value: any): this; | ||
orWhereIn(column: string, values: any[]): this; | ||
orWhereNotIn(column: string, values: any[]): this; | ||
orWhereNull(column: string): this; | ||
orWhereNotNull(column: string): this; | ||
orWhereExists(column: string): this; | ||
orWhereNotExists(column: string): this; | ||
orWhereBetween(column: string, range: number[]): this; | ||
orWhereNotBetween(column: string, range: number[]): this; | ||
orWhereRaw(raw: any): this; | ||
innerJoin(table: string, c1: string, operator: string, c2: string): this; | ||
innerJoin(table: string, c1: string, c2: string): this; | ||
innerJoin(builder: Knex$QueryBuilder, c1?: string, c2?: string): this; | ||
leftJoin(table: string, c1: string, operator: string, c2: string): this; | ||
leftJoin(table: string, c1: string, c2: string): this; | ||
leftJoin(builder: Knex$QueryBuilder): this; | ||
leftOuterJoin(table: string, c1: string, operator: string, c2: string): this; | ||
leftOuterJoin(table: string, c1: string, c2: string): this; | ||
rightJoin(table: string, c1: string, operator: string, c2: string): this; | ||
rightJoin(table: string, c1: string, c2: string): this; | ||
rightOuterJoin(table: string, c1: string, operator: string, c2: string): this; | ||
rightOuterJoin(table: string, c1: string, c2: string): this; | ||
outerJoin(table: string, c1: string, operator: string, c2: string): this; | ||
outerJoin(table: string, c1: string, c2: string): this; | ||
fullOuterJoin(table: string, c1: string, operator: string, c2: string): this; | ||
fullOuterJoin(table: string, c1: string, c2: string): this; | ||
crossJoin(column: string, c1: string, c2: string): this; | ||
crossJoin(column: string, c1: string, operator: string, c2: string): this; | ||
joinRaw(sql: string, bindings?: mixed[]): this; | ||
distinct(): this; | ||
groupBy(column: string): this; | ||
groupByRaw(): this; | ||
orderBy(column: string, direction?: 'desc' | 'asc'): this; | ||
orderByRaw(): this; | ||
offset(offset: number): this; | ||
limit(limit: number): this; | ||
having(column: string, operator: string, value: mixed): this; | ||
union(): this; | ||
unionAll(): this; | ||
count(column?: string): this; | ||
countDistinct(column?: string): this; | ||
min(column?: string): this; | ||
max(column?: string): this; | ||
sum(column?: string): this; | ||
sumDistinct(column?: string): this; | ||
avg(column?: string): this; | ||
avgDistinct(column?: string): this; | ||
pluck(column: string): this; | ||
first(): this; | ||
from(table: string): this; | ||
from(builder: Knex$QueryBuilderFn|Knex$Knex|Knex$QueryBuilder): this; | ||
insert(): this; | ||
del(): this; | ||
delete(): this; | ||
update(): this; | ||
returning(columns: string[]): this; | ||
} | ||
declare class Knex$Knex mixins Knex$QueryBuilder, Promise { | ||
static (config: Knex$Config): Knex$Knex; | ||
static QueryBuilder: typeof Knex$QueryBuilder; | ||
$call: (tableName: string) => Knex$QueryBuilder; | ||
raw(sqlString: string): any; | ||
client: any; | ||
destroy(): Promise<void>; | ||
} | ||
declare type Knex$PostgresConfig = { | ||
client?: 'pg', | ||
connection?: { | ||
host?: string, | ||
user?: string, | ||
password?: string, | ||
database?: string, | ||
charset?: string, | ||
}, | ||
searchPath?: string, | ||
} | ||
declare type Knex$MysqlConfig = { | ||
client?: 'mysql', | ||
connection?: { | ||
host?: string, | ||
user?: string, | ||
password?: string, | ||
database?: string, | ||
}, | ||
} | ||
declare type Knex$SqliteConfig = { | ||
client?: 'sqlite3', | ||
connection?: { | ||
filename?: string, | ||
} | ||
} | ||
declare type Knex$Config = Knex$PostgresConfig | Knex$MysqlConfig | Knex$SqliteConfig; | ||
declare module 'knex' { | ||
declare type Error = { | ||
name: string, | ||
length: number, | ||
severity: string, | ||
code: string, | ||
detail: string, | ||
hint?: string, | ||
position?: any, | ||
intenralPosition?: any, | ||
internalQuery?: any, | ||
where?: any, | ||
schema: string, | ||
table: string, | ||
column?: any, | ||
dataType?: any, | ||
constraint?: string, | ||
file: string, | ||
line: string, | ||
routine: string, | ||
} | ||
declare var exports: typeof Knex$Knex; | ||
} |
Oops, something went wrong.