mirror of
https://github.com/strapi/strapi.git
synced 2025-07-28 19:34:51 +00:00
fix tests
This commit is contained in:
parent
0d70c10363
commit
2bc2aaa96e
@ -78,9 +78,11 @@ describe('Transfer', () => {
|
|||||||
jest.spyOn(console, 'info').mockImplementation(() => {});
|
jest.spyOn(console, 'info').mockImplementation(() => {});
|
||||||
jest.spyOn(console, 'error').mockImplementation(() => {});
|
jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||||
|
|
||||||
const destinationUrl = new URL('http://strapi.com/admin');
|
const destinationUrl = new URL('http://one.localhost/admin');
|
||||||
const destinationToken = 'test-token';
|
const destinationToken = 'test-token';
|
||||||
|
|
||||||
|
const sourceUrl = new URL('http://two.localhost/admin');
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
@ -90,7 +92,19 @@ describe('Transfer', () => {
|
|||||||
await transferCommand({ from: undefined, to: undefined });
|
await transferCommand({ from: undefined, to: undefined });
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(console.error).toHaveBeenCalledWith(expect.stringMatching(/at least one source/i));
|
expect(console.error).toHaveBeenCalledWith(expect.stringMatching(/one source/i));
|
||||||
|
|
||||||
|
expect(
|
||||||
|
mockDataTransfer.strapi.providers.createRemoteStrapiDestinationProvider
|
||||||
|
).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('exits with error when both --to and --from are provided', async () => {
|
||||||
|
await expectExit(1, async () => {
|
||||||
|
await transferCommand({ from: sourceUrl, to: destinationUrl });
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(console.error).toHaveBeenCalledWith(expect.stringMatching(/one source/i));
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
mockDataTransfer.strapi.providers.createRemoteStrapiDestinationProvider
|
mockDataTransfer.strapi.providers.createRemoteStrapiDestinationProvider
|
||||||
@ -142,6 +156,8 @@ describe('Transfer', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.todo('uses local Strapi destination when to is not specified');
|
||||||
|
|
||||||
it('uses restore as the default strategy', async () => {
|
it('uses restore as the default strategy', async () => {
|
||||||
await expectExit(0, async () => {
|
await expectExit(0, async () => {
|
||||||
await transferCommand({ from: undefined, to: destinationUrl, toToken: destinationToken });
|
await transferCommand({ from: undefined, to: destinationUrl, toToken: destinationToken });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user