Merge pull request #17215 from strapi/fix/delete-deits-merge

This commit is contained in:
Christian 2023-07-07 12:46:22 +02:00 committed by GitHub
commit dda5eeebad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 27 deletions

View File

@ -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();
});
});
});

View File

@ -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 {