Test Coverage

Added test coverage for all of the QueryBuilder methods which are the foundation to all of the other classes methods like Card.
This commit is contained in:
Bradyn Glines
2018-01-21 11:12:47 -07:00
parent 7662573959
commit 643a54d40d
5 changed files with 346 additions and 4 deletions

View File

@ -25,7 +25,7 @@ export class QueryBuilder {
value: id
}];
return this.returnResponse(t.resource(), params);
return this.returnResponse(t.resource(), params, true);
}
static where<T extends Card | Set | Type | SuperType | SubType>(type: (new() => T), params: IQuery[]): Promise<T[]> {
@ -34,9 +34,13 @@ export class QueryBuilder {
return this.returnResponse(t.resource(), params);
}
private static returnResponse(resource: string, params: IQuery[]): Promise<any> {
private static returnResponse(resource: string, params: IQuery[], single?: boolean): Promise<any> {
return Client.get(resource, params)
.then(response => {
if (single) {
return response[0];
}
return response;
})
.catch(error => console.error(error));