2021-12-31 13:28:04 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const util = require('util');
|
|
|
|
const exec = util.promisify(require('child_process').exec);
|
|
|
|
|
|
|
|
jest.setTimeout(20000);
|
|
|
|
|
|
|
|
describe('Test the config-sync CLI', () => {
|
2022-09-04 10:42:52 +02:00
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
// Remove the generated files and the DB.
|
|
|
|
await exec('rm -rf config/sync');
|
|
|
|
await exec('rm -rf .tmp');
|
|
|
|
});
|
|
|
|
|
2021-12-31 13:28:04 +01:00
|
|
|
test('Export', async () => {
|
|
|
|
const { stdout } = await exec('yarn cs export -y');
|
|
|
|
expect(stdout).toContain('Finished export');
|
|
|
|
});
|
|
|
|
test('Import', async () => {
|
|
|
|
await exec('rm -rf config/sync/admin-role.strapi-editor.json');
|
|
|
|
const { stdout } = await exec('yarn cs import -y');
|
|
|
|
expect(stdout).toContain('Finished import');
|
|
|
|
});
|
|
|
|
test('Diff', async () => {
|
|
|
|
const { stdout } = await exec('yarn cs diff');
|
|
|
|
expect(stdout).toContain('No differences between DB and sync directory');
|
|
|
|
});
|
|
|
|
});
|