Refactor query interface imports

This commit is contained in:
Tee
2021-02-25 22:08:38 -05:00
parent 657605eaa0
commit 363bcfd321
3 changed files with 10 additions and 10 deletions

View File

@ -1,11 +1,11 @@
import * as chai from 'chai';
import { Client } from '../src/client';
import { IQuery } from '../src/interfaces/query';
import { Query } from '../src/interfaces/query';
const expect = chai.expect;
describe('Client', () => {
it('should get a single using the cards resource and query params' , () => {
const params: IQuery[] = [{
const params: Query[] = [{
name: 'id',
value: 'xy7-54'
}];
@ -26,7 +26,7 @@ describe('Client', () => {
});
it('should get sets using the sets resource and query params', () => {
const params: IQuery[] = [{
const params: Query[] = [{
name: 'name',
value: 'Base'
}];
@ -39,7 +39,7 @@ describe('Client', () => {
});
it('should get a single set using the sets resource and query params', () => {
const params: IQuery[] = [{
const params: Query[] = [{
name: 'id',
value: 'base1'
}];

View File

@ -1,7 +1,7 @@
import * as chai from 'chai';
import { Card } from '../src/classes/card';
import { QueryBuilder } from '../src/queryBuilder';
import { IQuery } from '../src/interfaces/query';
import { Query } from '../src/interfaces/query';
const expect = chai.expect;
describe('QueryBuilder', () => {
@ -14,7 +14,7 @@ describe('QueryBuilder', () => {
});
it('should use where to filter data', () => {
const params: IQuery[] = [
const params: Query[] = [
{
name: 'q',
value: 'name:Charizard set.id:base1'
@ -35,4 +35,4 @@ describe('QueryBuilder', () => {
expect(cards.length).to.equal(250);
});
});
});
});

View File

@ -1,12 +1,12 @@
import { Client } from './client';
import { Card } from './classes/card';
import { Set } from './classes/set';
import { IQuery } from './interfaces/query';
import { Query } from './interfaces/query';
export class QueryBuilder {
static all<T extends Card | Set>(type: {new (): T}): Promise<T[]> {
const t = new type();
const params: IQuery[] = [{
const params: Query[] = [{
name: 'pageSize',
value: 250,
}];
@ -20,7 +20,7 @@ export class QueryBuilder {
return Client.get(t.resource(), id);
}
static where<T extends Card | Set>(type: {new (): T}, params: IQuery[]): Promise<T[]> {
static where<T extends Card | Set>(type: {new (): T}, params: Query[]): Promise<T[]> {
const t = new type();
return Client.get(t.resource(), params);