Skip to content

Commit 2f86f5e

Browse files
author
naman-contentstack
committed
fix:updated failing test cases
1 parent 3967dc7 commit 2f86f5e

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe('Region command', function () {
1717
launchHubUrl: 'https://launch-api.contentstack.com',
1818
personalizeUrl: 'https://personalization-api.contentstack.com',
1919
composableStudioUrl: 'https://composable-studio-api.contentstack.com',
20+
assetManagementUrl: 'https://asset-management-api.contentstack.com',
2021
};
2122
let cliuxPrintStub: sinon.SinonStub;
2223
let configGetStub: sinon.SinonStub;
@@ -43,32 +44,32 @@ describe('Region command', function () {
4344
});
4445
it('should log an error and exit when the region is not set', async function () {
4546
const command = new GetRegionCommand([], {} as any);
46-
47+
4748
// Stub the region property to return undefined
4849
sinon.stub(command, 'region').get(() => undefined);
49-
50+
5051
// Stub the exit method to throw to stop execution
5152
const exitStub = sinon.stub(command, 'exit').throws(new Error('EXIT_CALLED'));
52-
53+
5354
// Stub cliux.error to capture error calls
5455
const errorStub = sinon.stub(cliux, 'error');
55-
56+
5657
// Reset cliuxPrintStub to capture new calls
5758
cliuxPrintStub.reset();
58-
59+
5960
// Call the run method directly, expect it to throw
6061
try {
6162
await command.run();
6263
} catch (error) {
6364
// Expected to throw due to exit stub
6465
}
65-
66+
6667
// Verify that cliux.error was called with the correct message
6768
expect(errorStub.calledWith('CLI_CONFIG_GET_REGION_NOT_FOUND')).to.be.true;
68-
69+
6970
// Verify exit was called
7071
expect(exitStub.called).to.be.true;
71-
72+
7273
errorStub.restore();
7374
});
7475

@@ -309,6 +310,7 @@ describe('Region command', function () {
309310
personalizeUrl: 'https://custom-personalize.com',
310311
launchHubUrl: 'https://custom-launch.com',
311312
composableStudioUrl: 'https://custom-composable-studio.com',
313+
assetManagementUrl: 'https://custom-asset-management.com',
312314
};
313315
const result = UserConfig.setCustomRegion(customRegion);
314316
expect(result).to.deep.equal(customRegion);

0 commit comments

Comments
 (0)