@@ -2,6 +2,7 @@ import { describe, it, beforeEach } from 'mocha'
22import { expect } from 'chai'
33import { jsonReader } from '../utility/fileOperations/readwrite'
44import { contentstackClient } from '../utility/ContentstackClient.js'
5+ import { environmentCreate } from '../mock/environment.js'
56import { stageBranch } from '../mock/branch.js'
67
78var client = { }
@@ -42,6 +43,7 @@ describe('Terms API Test', () => {
4243 } )
4344 it ( 'should create taxonomy' , async ( ) => {
4445 const response = await client . stack ( { api_key : process . env . API_KEY } ) . taxonomy ( ) . create ( { taxonomy } )
46+ await client . stack ( { api_key : process . env . API_KEY } ) . environment ( ) . create ( environmentCreate )
4547 expect ( response . uid ) . to . be . equal ( taxonomy . uid )
4648 await new Promise ( resolve => setTimeout ( resolve , 5000 ) )
4749 } , 10000 )
@@ -127,6 +129,35 @@ describe('Terms API Test', () => {
127129 . catch ( done )
128130 } )
129131
132+ it . skip ( 'should publish with api_version' , done => {
133+ const publishData = {
134+ locales : [ 'en-us' ] ,
135+ environments : [ 'development' ] ,
136+ items : [
137+ {
138+ uid : taxonomy . uid ,
139+ term_uid : 'term_test'
140+ } ,
141+ {
142+ uid : taxonomy . uid ,
143+ term_uid : 'term_test_child1'
144+ } ,
145+ {
146+ uid : taxonomy . uid ,
147+ term_uid : 'term_test_child2'
148+ }
149+ ]
150+ }
151+ makeTaxonomy ( )
152+ . publish ( publishData , '3.2' )
153+ . then ( ( response ) => {
154+ expect ( response . notice ) . to . not . equal ( null )
155+ expect ( response . job_id ) . to . not . equal ( undefined )
156+ done ( )
157+ } )
158+ . catch ( done )
159+ } )
160+
130161 it ( 'should search the term with the string passed' , done => {
131162 makeTerms ( taxonomy . uid ) . search ( termString )
132163 . then ( ( response ) => {
@@ -195,6 +226,10 @@ function makeTerms (taxonomyUid, termUid = null) {
195226 return client . stack ( { api_key : process . env . API_KEY } ) . taxonomy ( taxonomyUid ) . terms ( termUid )
196227}
197228
229+ function makeTaxonomy ( ) {
230+ return client . stack ( { api_key : process . env . API_KEY } ) . taxonomy ( )
231+ }
232+
198233describe ( 'Terms Query Parameters Sanity Tests' , ( ) => {
199234 beforeEach ( async ( ) => {
200235 const user = jsonReader ( 'loggedinuser.json' )
@@ -359,6 +394,7 @@ describe('Terms Query Parameters Sanity Tests', () => {
359394 skip : 0 ,
360395 limit : 10
361396 } )
397+ await client . stack ( { api_key : process . env . API_KEY } ) . environment ( environmentCreate . environment . name ) . delete ( )
362398 expect ( terms ) . to . have . property ( 'items' )
363399 expect ( terms . items ) . to . be . an ( 'array' )
364400 // Count property might not be available in all environments
0 commit comments