Skip to content

Commit

Permalink
add missing tests and remove ts ignore comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Huskydog9988 committed Sep 29, 2023
1 parent 37682c2 commit 58ea56a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 17 deletions.
7 changes: 7 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Networks } from './networks';
import { Shows } from './shows';
// api methods
import { Users } from './users';
import { Lists } from './lists';

const version = '';

Expand Down Expand Up @@ -136,6 +137,11 @@ export class Trakt {
*/
readonly networks: Networks;

/**
* Lists api
*/
readonly lists: Lists;

constructor(settings: TraktSettings) {
// apply settings
this.settings = {
Expand Down Expand Up @@ -169,5 +175,6 @@ export class Trakt {
this.genres = new Genres(apiConfig);
this.languages = new Languages(apiConfig);
this.networks = new Networks(apiConfig);
this.lists = new Lists(apiConfig);
}
}
42 changes: 41 additions & 1 deletion test/client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { Users, Certifications, Movies, Shows } from '../src';
import { Users, Certifications, Movies, Shows, Countries, Genres, Languages, Lists, Networks } from '../src';

import { Trakt } from '../src/client';

Expand Down Expand Up @@ -84,4 +84,44 @@ describe('Client', function () {
expect(client.shows).to.be.instanceOf(Shows);
});
});

describe('#countries', function () {
it('should be a class', function () {
const client = new Trakt({ clientId: '' });

expect(client.countries).to.be.instanceOf(Countries);
});
});

describe('#genres', function () {
it('should be a class', function () {
const client = new Trakt({ clientId: '' });

expect(client.genres).to.be.instanceOf(Genres);
});
});

describe('#languages', function () {
it('should be a class', function () {
const client = new Trakt({ clientId: '' });

expect(client.languages).to.be.instanceOf(Languages);
});
});

describe('#networks', function () {
it('should be a class', function () {
const client = new Trakt({ clientId: '' });

expect(client.networks).to.be.instanceOf(Networks);
});
});

describe('#lists', function () {
it('should be a class', function () {
const client = new Trakt({ clientId: '' });

expect(client.lists).to.be.instanceOf(Lists);
});
});
});
8 changes: 0 additions & 8 deletions test/lists.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ describe('Lists', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(lists.trending).to.throw(TypeError);
});
});
Expand All @@ -58,8 +56,6 @@ describe('Lists', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(lists.popular).to.throw(TypeError);
});
});
Expand Down Expand Up @@ -121,8 +117,6 @@ describe('Lists', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(lists.getItems).to.throw(TypeError);
});
});
Expand All @@ -142,8 +136,6 @@ describe('Lists', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(lists.getComments).to.throw(TypeError);
});
});
Expand Down
4 changes: 0 additions & 4 deletions test/media.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ describe('Media', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(shows.summary).to.throw(TypeError);
});
});
Expand All @@ -60,8 +58,6 @@ describe('Media', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(shows.people).to.throw(TypeError);
});
});
Expand Down
4 changes: 0 additions & 4 deletions test/users.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ describe('Users', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(users.watchedMovies).to.throw(TypeError);
});
});
Expand All @@ -58,8 +56,6 @@ describe('Users', function () {
apiUrl: '',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(users.watchedShows).to.throw(TypeError);
});
});
Expand Down

0 comments on commit 58ea56a

Please sign in to comment.