Skip to content

Commit a1a01a9

Browse files
test: mock cli-utilities in rollback tests to avoid uuid ESM error
1 parent 7b12842 commit a1a01a9

1 file changed

Lines changed: 2 additions & 19 deletions

File tree

src/commands/launch/rollback.test.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { launchCommand as cliUtilitiesJestMock } from '../../test/mocks/cli-utilities';
12
import Rollback from './rollback';
23
import { Logger } from '../../util';
34
import { cliux } from '@contentstack/cli-utilities';
@@ -12,25 +13,7 @@ jest.mock('../../util', () => {
1213
};
1314
});
1415

15-
jest.mock('@contentstack/cli-utilities', () => {
16-
const actual = jest.requireActual('@contentstack/cli-utilities');
17-
return {
18-
...actual,
19-
configHandler: {
20-
get: jest.fn((key) => {
21-
if (key === 'authtoken') return 'dummy-token';
22-
if (key === 'authorisationType') return 'OAuth';
23-
if (key === 'oauthAccessToken') return 'dummy-oauth-token';
24-
return undefined;
25-
}),
26-
},
27-
cliux: {
28-
...actual.cliux,
29-
inquire: jest.fn(),
30-
print: jest.fn(),
31-
},
32-
};
33-
});
16+
jest.mock('@contentstack/cli-utilities', () => cliUtilitiesJestMock);
3417

3518
const targetDeployment = {
3619
uid: 'target-uid',

0 commit comments

Comments
 (0)