@@ -2,7 +2,6 @@ import { expect } from 'chai';
22import * as sinon from 'sinon' ;
33import { configHandler , cliux } from '@contentstack/cli-utilities' ;
44import TokensAddCommand from '../../../src/commands/auth/tokens/add' ;
5- import { tokenValidation } from '../../../src/utils' ;
65import { stub , assert } from 'sinon' ;
76import { config as dotenvConfig } from 'dotenv' ;
87import nock from 'nock' ;
@@ -31,8 +30,6 @@ function resetConfig() {
3130 config . delete ( `${ configKeyTokens } .newToken` ) ;
3231}
3332describe ( 'Tokens Add Command' , ( ) => {
34- let apiKeyValidationStub : sinon . SinonStub ;
35- let environmentTokenValidationStub : sinon . SinonStub ;
3633 let printStub : sinon . SinonStub ;
3734 const validAPIKey = conf . validAPIKey ;
3835 const validDeliveryToken = '***REMOVED***' ;
@@ -43,28 +40,9 @@ describe('Tokens Add Command', () => {
4340 resetConfig ( ) ;
4441 if ( ( cliux . print as any ) . restore ) ( cliux . print as any ) . restore ( ) ;
4542 printStub = stub ( cliux , 'print' ) ;
46- apiKeyValidationStub = sinon
47- . stub ( tokenValidation , 'validateAPIKey' )
48- . callsFake ( function ( client : any , apiKey : string ) : Promise < any > {
49- if ( apiKey === validAPIKey ) {
50- return Promise . resolve ( { valid : true , message : 'success' } ) ;
51- }
52- return Promise . resolve ( { valid : false , message : 'failed' } ) ;
53- } ) ;
54-
55- environmentTokenValidationStub = sinon
56- . stub ( tokenValidation , 'validateEnvironment' )
57- . callsFake ( function ( client : any , apiKey : string , environment ) : Promise < any > {
58- if ( environment === validEnvironment ) {
59- return Promise . resolve ( { valid : true , message : 'success' } ) ;
60- }
61- return Promise . resolve ( { valid : false , message : 'failed' } ) ;
62- } ) ;
6343 } ) ;
6444
6545 after ( ( ) => {
66- apiKeyValidationStub . restore ( ) ;
67- environmentTokenValidationStub . restore ( ) ;
6846 printStub . restore ( ) ;
6947 resetConfig ( ) ;
7048 } ) ;
0 commit comments