diff --git a/packages/e2e/spec/entrypoint.spec.ts b/packages/e2e/spec/entrypoint.spec.ts index c8da77f7..a21a8dd0 100644 --- a/packages/e2e/spec/entrypoint.spec.ts +++ b/packages/e2e/spec/entrypoint.spec.ts @@ -21,7 +21,7 @@ import { } from './hooks/index.js'; import { excludeSomeCollections, - includeSomeCollections, + includeSomeCollections, noSnapshot, } from './exclude-include/index.js'; jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; @@ -64,4 +64,5 @@ describe('Pull and check if ids are preserved for some collections', () => { excludeSomeCollections(context); includeSomeCollections(context); + noSnapshot(context); }); diff --git a/packages/e2e/spec/exclude-include/index.ts b/packages/e2e/spec/exclude-include/index.ts index 44bfe5b9..cffd51b3 100644 --- a/packages/e2e/spec/exclude-include/index.ts +++ b/packages/e2e/spec/exclude-include/index.ts @@ -1,2 +1,3 @@ export * from './exclude-some-collections.js'; export * from './include-some-collections.js'; +export * from './no-snapshot.js'; diff --git a/packages/e2e/spec/exclude-include/no-snapshot.ts b/packages/e2e/spec/exclude-include/no-snapshot.ts new file mode 100644 index 00000000..4d229b75 --- /dev/null +++ b/packages/e2e/spec/exclude-include/no-snapshot.ts @@ -0,0 +1,59 @@ +import { + Context, + debug, +} from '../helpers/index.js'; +import Path from 'path'; +import fs from 'fs-extra'; + +export const noSnapshot = (context: Context) => { + it('should not pull schema from Directus', async () => { + // Init sync client + const sync = await context.getSync('temp/no-snapshot'); + + // -------------------------------------------------------------------- + // Pull the content from Directus + const output = await sync.pull(['--no-snapshot']); + + // -------------------------------------------------------------------- + // Check that the snapshot was ignored + expect(output).toContain(debug('Snapshot is disabled')); + + // -------------------------------------------------------------------- + // Check if the content was dumped correctly + const dumpPath = sync.getDumpPath(); + const snapshotPath = Path.join(dumpPath, 'snapshot'); + // Ensure folder is empty + const files = fs.readdirSync(snapshotPath); + expect(files).toEqual([]); + }); + + it('should not diff schema from Directus', async () => { + // Init sync client + const sync = await context.getSync('sources/one-item-per-collection', false); + + // -------------------------------------------------------------------- + // Pull the content from Directus + const output = await sync.diff(['--no-snapshot']); + + // -------------------------------------------------------------------- + // Check that the snapshot was ignored + expect(output).toContain(debug('Snapshot is disabled')); + expect(output).not.toContain(debug('[snapshot] No changes to apply')); + + }); + + it('should not diff schema from Directus', async () => { + // Init sync client + const sync = await context.getSync('sources/one-item-per-collection', false); + + // -------------------------------------------------------------------- + // Pull the content from Directus + const output = await sync.push(['--no-snapshot']); + + // -------------------------------------------------------------------- + // Check that the snapshot was ignored + expect(output).toContain(debug('Snapshot is disabled')); + expect(output).not.toContain(debug('[snapshot] No changes to apply')); + + }); +};