@@ -4,6 +4,8 @@ import { AxiosInstance, httpClient } from '@contentstack/core';
44import MockAdapter from 'axios-mock-adapter' ;
55import { taxonomyFindResponseDataMock } from '../utils/mocks' ;
66import { MOCK_CLIENT_OPTIONS } from '../utils/constant' ;
7+ import { Term } from '../../src/lib/term' ;
8+ import { TermQuery } from '../../src/lib/term-query' ;
79
810describe ( 'ta class' , ( ) => {
911 let taxonomies : TaxonomyQuery ;
@@ -21,6 +23,16 @@ describe('ta class', () => {
2123 taxonomy = new Taxonomy ( client , 'taxonomy_testing' ) ;
2224 } ) ;
2325
26+ it ( 'should give term instance when term method is called with termUid' , ( ) => {
27+ const query = taxonomy . term ( 'termUid' ) ;
28+ expect ( query ) . toBeInstanceOf ( Term ) ;
29+ } ) ;
30+
31+ it ( 'should give term query instance when term method is called without termUid' , ( ) => {
32+ const query = taxonomy . term ( )
33+ expect ( query ) . toBeInstanceOf ( TermQuery ) ;
34+ } ) ;
35+
2436 it ( 'should return all taxonomies in the response data when successful' , async ( ) => {
2537 mockClient . onGet ( '/taxonomy-manager' ) . reply ( 200 , taxonomyFindResponseDataMock ) ; //TODO: change to /taxonomies
2638 const response = await taxonomies . find ( ) ;
@@ -30,6 +42,6 @@ describe('ta class', () => {
3042 it ( 'should return single taxonomy in the response data when successful' , async ( ) => {
3143 mockClient . onGet ( '/taxonomy-manager/taxonomy_testing' ) . reply ( 200 , taxonomyFindResponseDataMock . taxonomies [ 0 ] ) ; //TODO: change to /taxonomies/taxonomyUid
3244 const response = await taxonomy . fetch ( ) ;
33- expect ( response ) . toEqual ( taxonomyFindResponseDataMock . taxonomies [ 0 ] ) ; //TODO: change to taxonomyFindResponseDataMock
45+ expect ( response ) . toEqual ( taxonomyFindResponseDataMock . taxonomies [ 0 ] ) ;
3446 } ) ;
3547} ) ;
0 commit comments