@squiz/dxp-cli-next 5.26.0-develop.3 → 5.26.0-develop.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/migration/index.js +2 -0
- package/lib/migration/revert/revert.d.ts +3 -0
- package/lib/migration/revert/revert.js +48 -0
- package/lib/migration/revert/revert.spec.d.ts +1 -0
- package/lib/migration/revert/revert.spec.js +150 -0
- package/lib/migration/types.d.ts +5 -0
- package/lib/migration/utils.d.ts +2 -1
- package/lib/migration/utils.js +25 -1
- package/lib/migration/utils.spec.js +67 -0
- package/package.json +1 -1
package/lib/migration/index.js
CHANGED
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const createMigration_1 = __importDefault(require("./create/createMigration"));
|
|
8
8
|
const getMigration_1 = __importDefault(require("./get/getMigration"));
|
|
9
|
+
const revert_1 = __importDefault(require("./revert/revert"));
|
|
9
10
|
const setMigrationSettings_1 = __importDefault(require("./settings/setMigrationSettings"));
|
|
10
11
|
const migrationCommand = new commander_1.Command('migration');
|
|
11
12
|
migrationCommand
|
|
12
13
|
.description('AI Page Migration Service Commands')
|
|
13
14
|
.addCommand((0, createMigration_1.default)())
|
|
14
15
|
.addCommand((0, getMigration_1.default)())
|
|
16
|
+
.addCommand((0, revert_1.default)())
|
|
15
17
|
.addCommand((0, setMigrationSettings_1.default)());
|
|
16
18
|
exports.default = migrationCommand;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
16
|
+
const commander_1 = require("commander");
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
|
+
const ora_1 = __importDefault(require("ora"));
|
|
19
|
+
const revertMigrationCommand = () => {
|
|
20
|
+
const revertCommand = new commander_1.Command('revert')
|
|
21
|
+
.name('revert')
|
|
22
|
+
.description('Revert the current stage of a migration using the AI Page migration service')
|
|
23
|
+
.addOption(new commander_1.Option('--migration-id <string>', 'The ID of the migration to revert').makeOptionMandatory())
|
|
24
|
+
.addOption(new commander_1.Option('--asset-id <string>', 'The ID of the asset to revert the migration for'))
|
|
25
|
+
.addOption(new commander_1.Option('-t, --tenant <string>', 'Tenant ID to run against. If not provided will use configured tenant from login'))
|
|
26
|
+
.configureOutput({
|
|
27
|
+
outputError(str, write) {
|
|
28
|
+
write(chalk_1.default.red(str));
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
.action((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const spinner = (0, ora_1.default)('Reverting...').start();
|
|
33
|
+
yield (0, utils_1.throwErrorIfNotLoggedIn)(revertCommand);
|
|
34
|
+
try {
|
|
35
|
+
const response = yield (0, utils_1.revertMigration)(options);
|
|
36
|
+
spinner.succeed(response.message);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
spinner.fail();
|
|
40
|
+
(0, utils_1.handleCommandError)(revertCommand, error);
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
if (process.env.ENABLE_OVERRIDE_MIGRATION_URL === 'true') {
|
|
44
|
+
revertCommand.addOption(new commander_1.Option('-ou, --overrideUrl <string>', 'Developer option to override the entire migration url with a custom value'));
|
|
45
|
+
}
|
|
46
|
+
return revertCommand;
|
|
47
|
+
};
|
|
48
|
+
exports.default = revertMigrationCommand;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const revert_1 = __importDefault(require("./revert"));
|
|
39
|
+
const utils = __importStar(require("../utils"));
|
|
40
|
+
jest.mock('../utils');
|
|
41
|
+
jest.mock('../../ApplicationStore');
|
|
42
|
+
const mockUtils = utils;
|
|
43
|
+
describe('revertMigrationCommand', () => {
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
jest.clearAllMocks();
|
|
46
|
+
jest.resetAllMocks();
|
|
47
|
+
});
|
|
48
|
+
describe('command configuration', () => {
|
|
49
|
+
it('should have correct command name and description', () => {
|
|
50
|
+
const program = (0, revert_1.default)();
|
|
51
|
+
expect(program.name()).toBe('revert');
|
|
52
|
+
expect(program.description()).toBe('Revert the current stage of a migration using the AI Page migration service');
|
|
53
|
+
});
|
|
54
|
+
it('should have required migration-id option', () => {
|
|
55
|
+
const program = (0, revert_1.default)();
|
|
56
|
+
const options = program.options;
|
|
57
|
+
const migrationIdOption = options.find((opt) => opt.long === '--migration-id');
|
|
58
|
+
expect(migrationIdOption).toBeDefined();
|
|
59
|
+
expect(migrationIdOption === null || migrationIdOption === void 0 ? void 0 : migrationIdOption.mandatory).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
it('should have optional asset-id option', () => {
|
|
62
|
+
const program = (0, revert_1.default)();
|
|
63
|
+
const options = program.options;
|
|
64
|
+
const assetIdOption = options.find((opt) => opt.long === '--asset-id');
|
|
65
|
+
expect(assetIdOption).toBeDefined();
|
|
66
|
+
expect(assetIdOption === null || assetIdOption === void 0 ? void 0 : assetIdOption.mandatory).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
it('should have optional tenant option', () => {
|
|
69
|
+
const program = (0, revert_1.default)();
|
|
70
|
+
const options = program.options;
|
|
71
|
+
const tenantOption = options.find((opt) => opt.long === '--tenant');
|
|
72
|
+
expect(tenantOption).toBeDefined();
|
|
73
|
+
expect(tenantOption === null || tenantOption === void 0 ? void 0 : tenantOption.mandatory).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('command execution', () => {
|
|
77
|
+
it('should revert migration successfully with required options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
const mockResponse = { message: 'Migration reverted successfully' };
|
|
79
|
+
mockUtils.revertMigration.mockResolvedValue(mockResponse);
|
|
80
|
+
mockUtils.throwErrorIfNotLoggedIn.mockResolvedValue();
|
|
81
|
+
const program = (0, revert_1.default)();
|
|
82
|
+
yield program.parseAsync([
|
|
83
|
+
'node',
|
|
84
|
+
'dxp-cli',
|
|
85
|
+
'migration',
|
|
86
|
+
'revert',
|
|
87
|
+
'--migration-id',
|
|
88
|
+
'migration-123',
|
|
89
|
+
'--asset-id',
|
|
90
|
+
'asset-456',
|
|
91
|
+
]);
|
|
92
|
+
expect(mockUtils.throwErrorIfNotLoggedIn).toHaveBeenCalledWith(program);
|
|
93
|
+
expect(mockUtils.revertMigration).toHaveBeenCalledWith({
|
|
94
|
+
migrationId: 'migration-123',
|
|
95
|
+
assetId: 'asset-456',
|
|
96
|
+
});
|
|
97
|
+
expect(mockUtils.handleCommandError).not.toHaveBeenCalled();
|
|
98
|
+
}));
|
|
99
|
+
it('should revert migration with tenant option', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
+
const mockResponse = { message: 'Migration reverted successfully' };
|
|
101
|
+
mockUtils.revertMigration.mockResolvedValue(mockResponse);
|
|
102
|
+
mockUtils.throwErrorIfNotLoggedIn.mockResolvedValue();
|
|
103
|
+
const program = (0, revert_1.default)();
|
|
104
|
+
yield program.parseAsync([
|
|
105
|
+
'node',
|
|
106
|
+
'dxp-cli',
|
|
107
|
+
'migration',
|
|
108
|
+
'revert',
|
|
109
|
+
'--migration-id',
|
|
110
|
+
'migration-123',
|
|
111
|
+
'--asset-id',
|
|
112
|
+
'asset-456',
|
|
113
|
+
'--tenant',
|
|
114
|
+
'test-tenant',
|
|
115
|
+
]);
|
|
116
|
+
expect(mockUtils.revertMigration).toHaveBeenCalledWith({
|
|
117
|
+
migrationId: 'migration-123',
|
|
118
|
+
assetId: 'asset-456',
|
|
119
|
+
tenant: 'test-tenant',
|
|
120
|
+
});
|
|
121
|
+
}));
|
|
122
|
+
it('should handle revert migration error', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
+
const error = new Error('Revert failed');
|
|
124
|
+
mockUtils.revertMigration.mockRejectedValue(error);
|
|
125
|
+
mockUtils.throwErrorIfNotLoggedIn.mockResolvedValue();
|
|
126
|
+
const program = (0, revert_1.default)();
|
|
127
|
+
yield program.parseAsync([
|
|
128
|
+
'node',
|
|
129
|
+
'dxp-cli',
|
|
130
|
+
'migration',
|
|
131
|
+
'revert',
|
|
132
|
+
'--migration-id',
|
|
133
|
+
'migration-123',
|
|
134
|
+
'--asset-id',
|
|
135
|
+
'asset-456',
|
|
136
|
+
]);
|
|
137
|
+
expect(mockUtils.handleCommandError).toHaveBeenCalledWith(program, error);
|
|
138
|
+
}));
|
|
139
|
+
it('should include override URL option when environment variable is set', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
+
const originalEnv = process.env.ENABLE_OVERRIDE_MIGRATION_URL;
|
|
141
|
+
process.env.ENABLE_OVERRIDE_MIGRATION_URL = 'true';
|
|
142
|
+
const program = (0, revert_1.default)();
|
|
143
|
+
const options = program.options;
|
|
144
|
+
const overrideUrlOption = options.find((opt) => opt.long === '--overrideUrl');
|
|
145
|
+
expect(overrideUrlOption).toBeDefined();
|
|
146
|
+
expect(overrideUrlOption === null || overrideUrlOption === void 0 ? void 0 : overrideUrlOption.mandatory).toBe(false);
|
|
147
|
+
process.env.ENABLE_OVERRIDE_MIGRATION_URL = originalEnv;
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
});
|
package/lib/migration/types.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export interface GetMigrationAPIResponse {
|
|
|
35
35
|
previewPageAssetId?: string;
|
|
36
36
|
componentsTarDownloadUrl?: string;
|
|
37
37
|
}
|
|
38
|
+
export interface RevertMigrationOptions extends GetMigrationOptions {
|
|
39
|
+
}
|
|
40
|
+
export interface RevertMigrationAPIResponse {
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
38
43
|
export interface SetMigrationSettingOptions {
|
|
39
44
|
matrixUrl: string;
|
|
40
45
|
matrixIdentifier: string;
|
package/lib/migration/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { CreateMigrationOptions, CreateMigrationAPIResponse, GetMigrationOptions, GetMigrationAPIResponse, SetMigrationSettingOptions, SetMigrationSettingAPIResponse } from './types';
|
|
2
|
+
import { CreateMigrationOptions, CreateMigrationAPIResponse, GetMigrationOptions, GetMigrationAPIResponse, RevertMigrationOptions, RevertMigrationAPIResponse, SetMigrationSettingOptions, SetMigrationSettingAPIResponse } from './types';
|
|
3
3
|
export declare function handleCommandError(command: Command, error: Error): void;
|
|
4
4
|
export declare function throwErrorIfNotLoggedIn(command: Command): Promise<void>;
|
|
5
5
|
export declare function buildMigrationUrl(tenantID?: string, overrideUrl?: string): Promise<string>;
|
|
@@ -11,4 +11,5 @@ export declare function getMigrationHeaders(tenantID?: string): Promise<Record<s
|
|
|
11
11
|
export declare function uploadFileToS3(uploadUrl: string, filePath: string, tenantID?: string): Promise<string>;
|
|
12
12
|
export declare function createMigration(options: CreateMigrationOptions): Promise<CreateMigrationAPIResponse>;
|
|
13
13
|
export declare function getMigration(options: GetMigrationOptions): Promise<GetMigrationAPIResponse>;
|
|
14
|
+
export declare function revertMigration(options: RevertMigrationOptions): Promise<RevertMigrationAPIResponse>;
|
|
14
15
|
export declare function setMigrationSetting(options: SetMigrationSettingOptions): Promise<SetMigrationSettingAPIResponse>;
|
package/lib/migration/utils.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.setMigrationSetting = exports.getMigration = exports.createMigration = exports.uploadFileToS3 = exports.getMigrationHeaders = exports.createTarFile = exports.validateExportFolder = exports.redactKey = exports.validateAxiosStatus = exports.buildMigrationUrl = exports.throwErrorIfNotLoggedIn = exports.handleCommandError = void 0;
|
|
15
|
+
exports.setMigrationSetting = exports.revertMigration = exports.getMigration = exports.createMigration = exports.uploadFileToS3 = exports.getMigrationHeaders = exports.createTarFile = exports.validateExportFolder = exports.redactKey = exports.validateAxiosStatus = exports.buildMigrationUrl = exports.throwErrorIfNotLoggedIn = exports.handleCommandError = void 0;
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -233,6 +233,30 @@ function getMigration(options) {
|
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
exports.getMigration = getMigration;
|
|
236
|
+
function revertMigration(options) {
|
|
237
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
const apiService = new ApiService_1.ApiService({
|
|
239
|
+
validateStatus: validateAxiosStatus,
|
|
240
|
+
});
|
|
241
|
+
const migrationUrl = yield buildMigrationUrl(options.tenant, options.overrideUrl);
|
|
242
|
+
try {
|
|
243
|
+
const response = yield apiService.client.post(`${migrationUrl}/migrations/${options.migrationId}/assets/${options.assetId}/rollback`, {}, {
|
|
244
|
+
headers: Object.assign({ 'Content-Type': 'application/json' }, (yield getMigrationHeaders(options.tenant))),
|
|
245
|
+
});
|
|
246
|
+
if (response.status !== 200) {
|
|
247
|
+
throw new Error(`Failed to revert migration: ${response.status}`);
|
|
248
|
+
}
|
|
249
|
+
return response.data;
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
if (error instanceof Error) {
|
|
253
|
+
throw error;
|
|
254
|
+
}
|
|
255
|
+
throw new Error(`Failed to revert migration: ${error}`);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
exports.revertMigration = revertMigration;
|
|
236
260
|
function setMigrationSetting(options) {
|
|
237
261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
238
262
|
const apiService = new ApiService_1.ApiService({
|
|
@@ -547,4 +547,71 @@ describe('Migration Utils', () => {
|
|
|
547
547
|
expect(mockApiServiceInstance.client.get).toHaveBeenCalledWith('https://example.com/__dxp/service/aiapps/migration/migrations/migration-123/assets/asset-456', expect.any(Object));
|
|
548
548
|
}));
|
|
549
549
|
});
|
|
550
|
+
describe('revertMigration', () => {
|
|
551
|
+
const mockOptions = {
|
|
552
|
+
migrationId: 'migration-123',
|
|
553
|
+
assetId: 'asset-456',
|
|
554
|
+
tenant: 'test-tenant',
|
|
555
|
+
};
|
|
556
|
+
const mockApiServiceInstance = {
|
|
557
|
+
client: {
|
|
558
|
+
post: jest.fn(),
|
|
559
|
+
},
|
|
560
|
+
};
|
|
561
|
+
beforeEach(() => {
|
|
562
|
+
mockApiService.mockImplementation(() => mockApiServiceInstance);
|
|
563
|
+
mockFetchApplicationConfig.mockResolvedValue({
|
|
564
|
+
baseUrl: 'https://test.example.com',
|
|
565
|
+
tenant: 'test-tenant',
|
|
566
|
+
region: 'us-east-1',
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
it('should revert migration successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
570
|
+
const mockResponse = {
|
|
571
|
+
status: 200,
|
|
572
|
+
data: { message: 'Migration reverted successfully' },
|
|
573
|
+
};
|
|
574
|
+
mockApiServiceInstance.client.post.mockResolvedValue(mockResponse);
|
|
575
|
+
const result = yield (0, utils_1.revertMigration)(mockOptions);
|
|
576
|
+
expect(result).toEqual({ message: 'Migration reverted successfully' });
|
|
577
|
+
expect(mockApiServiceInstance.client.post).toHaveBeenCalledWith('https://test.example.com/__dxp/service/aiapps/migration/migrations/migration-123/assets/asset-456/rollback', {}, {
|
|
578
|
+
headers: {
|
|
579
|
+
'Content-Type': 'application/json',
|
|
580
|
+
'x-dxp-tenant': 'test-tenant',
|
|
581
|
+
},
|
|
582
|
+
});
|
|
583
|
+
}));
|
|
584
|
+
it('should handle non-success status codes', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
585
|
+
const mockResponse = {
|
|
586
|
+
status: 400,
|
|
587
|
+
data: {},
|
|
588
|
+
};
|
|
589
|
+
mockApiServiceInstance.client.post.mockResolvedValue(mockResponse);
|
|
590
|
+
yield expect((0, utils_1.revertMigration)(mockOptions)).rejects.toThrow('Failed to revert migration: 400');
|
|
591
|
+
}));
|
|
592
|
+
it('should handle API service errors', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
593
|
+
const error = new Error('Network error');
|
|
594
|
+
mockApiServiceInstance.client.post.mockRejectedValue(error);
|
|
595
|
+
yield expect((0, utils_1.revertMigration)(mockOptions)).rejects.toThrow('Network error');
|
|
596
|
+
}));
|
|
597
|
+
it('should handle unknown errors', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
598
|
+
mockApiServiceInstance.client.post.mockRejectedValue('Unknown error');
|
|
599
|
+
yield expect((0, utils_1.revertMigration)(mockOptions)).rejects.toThrow('Failed to revert migration: Unknown error');
|
|
600
|
+
}));
|
|
601
|
+
it('should use override URL when provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
602
|
+
const mockResponse = {
|
|
603
|
+
status: 200,
|
|
604
|
+
data: { message: 'Migration reverted successfully' },
|
|
605
|
+
};
|
|
606
|
+
mockApiServiceInstance.client.post.mockResolvedValue(mockResponse);
|
|
607
|
+
const optionsWithOverride = Object.assign(Object.assign({}, mockOptions), { overrideUrl: 'https://custom.migration.url' });
|
|
608
|
+
yield (0, utils_1.revertMigration)(optionsWithOverride);
|
|
609
|
+
expect(mockApiServiceInstance.client.post).toHaveBeenCalledWith('https://custom.migration.url/migrations/migration-123/assets/asset-456/rollback', {}, {
|
|
610
|
+
headers: {
|
|
611
|
+
'Content-Type': 'application/json',
|
|
612
|
+
'x-dxp-tenant': 'test-tenant',
|
|
613
|
+
},
|
|
614
|
+
});
|
|
615
|
+
}));
|
|
616
|
+
});
|
|
550
617
|
});
|