From 58ea56ac08b3769d5ce0b410b7948830f51c5cd2 Mon Sep 17 00:00:00 2001 From: Husky <39809509+Huskydog9988@users.noreply.github.com> Date: Fri, 29 Sep 2023 11:51:43 -0400 Subject: [PATCH] add missing tests and remove ts ignore comments --- src/client.ts | 7 +++++++ test/client.spec.ts | 42 +++++++++++++++++++++++++++++++++++++++++- test/lists.spec.ts | 8 -------- test/media.spec.ts | 4 ---- test/users.spec.ts | 4 ---- 5 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/client.ts b/src/client.ts index 391a94f..3c7d331 100644 --- a/src/client.ts +++ b/src/client.ts @@ -8,6 +8,7 @@ import { Networks } from './networks'; import { Shows } from './shows'; // api methods import { Users } from './users'; +import { Lists } from './lists'; const version = ''; @@ -136,6 +137,11 @@ export class Trakt { */ readonly networks: Networks; + /** + * Lists api + */ + readonly lists: Lists; + constructor(settings: TraktSettings) { // apply settings this.settings = { @@ -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); } } diff --git a/test/client.spec.ts b/test/client.spec.ts index 9bfa2af..52227f7 100644 --- a/test/client.spec.ts +++ b/test/client.spec.ts @@ -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'; @@ -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); + }); + }); }); diff --git a/test/lists.spec.ts b/test/lists.spec.ts index d912110..29e83b8 100644 --- a/test/lists.spec.ts +++ b/test/lists.spec.ts @@ -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); }); }); @@ -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); }); }); @@ -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); }); }); @@ -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); }); }); diff --git a/test/media.spec.ts b/test/media.spec.ts index df0d7e2..989687f 100644 --- a/test/media.spec.ts +++ b/test/media.spec.ts @@ -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); }); }); @@ -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); }); }); diff --git a/test/users.spec.ts b/test/users.spec.ts index 630a8c5..90fa950 100644 --- a/test/users.spec.ts +++ b/test/users.spec.ts @@ -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); }); }); @@ -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); }); });