mirror of
https://github.com/strapi/strapi.git
synced 2025-08-06 07:50:02 +00:00
Merge pull request #17215 from strapi/fix/delete-deits-merge
This commit is contained in:
commit
dda5eeebad
@ -51,7 +51,7 @@ describe('Local Strapi Source Destination', () => {
|
||||
});
|
||||
|
||||
describe('Strategy', () => {
|
||||
test('requires strategy to be either restore or merge', async () => {
|
||||
test('requires strategy to be restore', async () => {
|
||||
const restoreProvider = createLocalStrapiDestinationProvider({
|
||||
getStrapi: getStrapiFactory({
|
||||
db: { transaction },
|
||||
@ -61,15 +61,6 @@ describe('Local Strapi Source Destination', () => {
|
||||
await restoreProvider.bootstrap();
|
||||
expect(restoreProvider.strapi).toBeDefined();
|
||||
|
||||
const mergeProvider = createLocalStrapiDestinationProvider({
|
||||
getStrapi: getStrapiFactory({
|
||||
db: { transaction },
|
||||
}),
|
||||
strategy: 'merge',
|
||||
});
|
||||
await mergeProvider.bootstrap();
|
||||
expect(mergeProvider.strapi).toBeDefined();
|
||||
|
||||
await expect(
|
||||
(async () => {
|
||||
const invalidProvider = createLocalStrapiDestinationProvider({
|
||||
@ -153,21 +144,5 @@ describe('Local Strapi Source Destination', () => {
|
||||
|
||||
expect(deleteAllSpy).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
test('Should not delete if it is a merge strategy', async () => {
|
||||
const provider = createLocalStrapiDestinationProvider({
|
||||
getStrapi: getStrapiFactory({
|
||||
db: {
|
||||
transaction,
|
||||
},
|
||||
}),
|
||||
strategy: 'merge',
|
||||
});
|
||||
const deleteAllSpy = jest.spyOn(restoreApi, 'deleteRecords');
|
||||
await provider.bootstrap();
|
||||
await provider.beforeTransfer();
|
||||
|
||||
expect(deleteAllSpy).not.toBeCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ import * as utils from '../../../utils';
|
||||
import { ProviderTransferError, ProviderValidationError } from '../../../errors/providers';
|
||||
import { assertValidStrapi } from '../../../utils/providers';
|
||||
|
||||
export const VALID_CONFLICT_STRATEGIES = ['restore', 'merge'];
|
||||
export const VALID_CONFLICT_STRATEGIES = ['restore'];
|
||||
export const DEFAULT_CONFLICT_STRATEGY = 'restore';
|
||||
|
||||
export interface ILocalStrapiDestinationProviderOptions {
|
||||
|
Loading…
x
Reference in New Issue
Block a user