-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0dd4206
commit 43030c8
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './exclude-some-collections.js'; | ||
export * from './include-some-collections.js'; | ||
export * from './no-snapshot.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')); | ||
|
||
}); | ||
}; |