Skip to content

Commit 747751b

Browse files
author
naman-contentstack
committed
fix: update failing test case
1 parent 31fc859 commit 747751b

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

packages/contentstack-config/test/unit/commands/region.test.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { expect } from 'chai';
22
import * as sinon from 'sinon';
3-
import { configHandler } from '@contentstack/cli-utilities';
3+
import { configHandler, log, cliux } from '@contentstack/cli-utilities';
44
import GetRegionCommand from '../../../src/commands/config/get/region';
5-
import { cliux } from '@contentstack/cli-utilities';
65
import { Region } from '../../../src/interfaces';
76
import UserConfig from '../../../src/utils/region-handler';
87
import { askCustomRegion, askRegions } from '../../../src/utils/interactive';
@@ -51,10 +50,6 @@ describe('Region command', function () {
5150
// Stub the exit method to throw to stop execution
5251
const exitStub = sinon.stub(command, 'exit').throws(new Error('EXIT_CALLED'));
5352

54-
// Mock the logger with error method
55-
const loggerErrorStub = sinon.stub();
56-
command.logger = { error: loggerErrorStub } as any;
57-
5853
// Stub cliux.error to capture error calls
5954
const errorStub = sinon.stub(cliux, 'error');
6055

@@ -68,10 +63,7 @@ describe('Region command', function () {
6863
// Expected to throw due to exit stub
6964
}
7065

71-
// Verify that logger.error was called
72-
expect(loggerErrorStub.calledWith('No region is set.')).to.be.true;
73-
74-
// Verify that cliux.error was called
66+
// Verify that cliux.error was called with the correct message
7567
expect(errorStub.calledWith('CLI_CONFIG_GET_REGION_NOT_FOUND')).to.be.true;
7668

7769
// Verify exit was called

0 commit comments

Comments
 (0)