-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): add hooks and dependencies tests (#50)
* test(e2e): add pushTwiceOnEmptyInstance * test(e2e): add pushWithDependencies * test(e2e): add onDump tests * test(e2e): add onSave tests * test(e2e): add onSave duplicate entries tests * test(e2e): add onLoad tests * test(e2e): add onQuery tests
- Loading branch information
1 parent
ab545af
commit 45f1a2b
Showing
66 changed files
with
13,928 additions
and
32 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
module.exports = { | ||
hooks: { | ||
dashboards: { | ||
onDump: (dashboards) => { | ||
return dashboards.map((dashboard) => { | ||
dashboard.name = `[onDump dashboard] ${dashboard.name}`; | ||
return dashboard; | ||
}); | ||
}, | ||
}, | ||
flows: { | ||
onDump: (flows) => { | ||
return flows.map((flow) => { | ||
flow.name = `[onDump flow] ${flow.name}`; | ||
return flow; | ||
}); | ||
}, | ||
}, | ||
folders: { | ||
onDump: (folders) => { | ||
return folders.map((folder) => { | ||
folder.name = `[onDump folder] ${folder.name}`; | ||
return folder; | ||
}); | ||
}, | ||
}, | ||
operations: { | ||
onDump: (operations) => { | ||
return operations.map((operation) => { | ||
operation.name = `[onDump operation] ${operation.name}`; | ||
return operation; | ||
}); | ||
}, | ||
}, | ||
panels: { | ||
onDump: (panels) => { | ||
return panels.map((panel) => { | ||
panel.name = `[onDump panel] ${panel.name}`; | ||
return panel; | ||
}); | ||
}, | ||
}, | ||
roles: { | ||
onDump: (roles) => { | ||
return roles.map((role) => { | ||
role.name = `[onDump role] ${role.name}`; | ||
return role; | ||
}); | ||
}, | ||
}, | ||
permissions: { | ||
onDump: (permissions) => { | ||
return permissions.map((permission) => { | ||
permission.collection = `[onDump permission] ${permission.collection}`; | ||
return permission; | ||
}); | ||
}, | ||
}, | ||
presets: { | ||
onDump: (presets) => { | ||
return presets.map((preset) => { | ||
preset.bookmark = `[onDump preset] ${preset.bookmark}`; | ||
return preset; | ||
}); | ||
}, | ||
}, | ||
settings: { | ||
onDump: (settings) => { | ||
return settings.map((setting) => { | ||
setting.project_name = `[onDump settings] ${setting.project_name}`; | ||
return setting; | ||
}); | ||
}, | ||
}, | ||
translations: { | ||
onDump: (translations) => { | ||
return translations.map((translation) => { | ||
translation.value = `[onDump translation] ${translation.value}`; | ||
return translation; | ||
}); | ||
}, | ||
}, | ||
webhooks: { | ||
onDump: (webhooks) => { | ||
return webhooks.map((webhook) => { | ||
webhook.name = `[onDump webhook] ${webhook.name}`; | ||
return webhook; | ||
}); | ||
}, | ||
}, | ||
}, | ||
}; |
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,92 @@ | ||
module.exports = { | ||
hooks: { | ||
dashboards: { | ||
onLoad: (dashboards) => { | ||
return dashboards.map((dashboard) => { | ||
dashboard.name = `[onLoad dashboard] ${dashboard.name}`; | ||
return dashboard; | ||
}); | ||
}, | ||
}, | ||
flows: { | ||
onLoad: (flows) => { | ||
return flows.map((flow) => { | ||
flow.name = `[onLoad flow] ${flow.name}`; | ||
return flow; | ||
}); | ||
}, | ||
}, | ||
folders: { | ||
onLoad: (folders) => { | ||
return folders.map((folder) => { | ||
folder.name = `[onLoad folder] ${folder.name}`; | ||
return folder; | ||
}); | ||
}, | ||
}, | ||
operations: { | ||
onLoad: (operations) => { | ||
return operations.map((operation) => { | ||
operation.name = `[onLoad operation] ${operation.name}`; | ||
return operation; | ||
}); | ||
}, | ||
}, | ||
panels: { | ||
onLoad: (panels) => { | ||
return panels.map((panel) => { | ||
panel.name = `[onLoad panel] ${panel.name}`; | ||
return panel; | ||
}); | ||
}, | ||
}, | ||
roles: { | ||
onLoad: (roles) => { | ||
return roles.map((role) => { | ||
role.name = `[onLoad role] ${role.name}`; | ||
return role; | ||
}); | ||
}, | ||
}, | ||
permissions: { | ||
onLoad: (permissions) => { | ||
return permissions.map((permission) => { | ||
permission.collection = `[onLoad permission] ${permission.collection}`; | ||
return permission; | ||
}); | ||
}, | ||
}, | ||
presets: { | ||
onLoad: (presets) => { | ||
return presets.map((preset) => { | ||
preset.bookmark = `[onLoad preset] ${preset.bookmark}`; | ||
return preset; | ||
}); | ||
}, | ||
}, | ||
settings: { | ||
onLoad: (settings) => { | ||
return settings.map((setting) => { | ||
setting.project_name = `[onLoad settings] ${setting.project_name}`; | ||
return setting; | ||
}); | ||
}, | ||
}, | ||
translations: { | ||
onLoad: (translations) => { | ||
return translations.map((translation) => { | ||
translation.value = `[onLoad translation] ${translation.value}`; | ||
return translation; | ||
}); | ||
}, | ||
}, | ||
webhooks: { | ||
onLoad: (webhooks) => { | ||
return webhooks.map((webhook) => { | ||
webhook.name = `[onLoad webhook] ${webhook.name}`; | ||
return webhook; | ||
}); | ||
}, | ||
}, | ||
}, | ||
}; |
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,103 @@ | ||
module.exports = { | ||
hooks: { | ||
dashboards: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
name: { _eq: '@dashboard' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
flows: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
name: { _eq: '@flow' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
folders: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
name: { _eq: '@folder' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
operations: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
name: { _eq: '@operation' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
panels: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
name: { _eq: '@panel' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
roles: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
name: { _eq: '@role' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
permissions: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
collection: { _eq: '@permission' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
presets: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
bookmark: { _eq: '@preset' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
settings: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
project_name: { _eq: '@settings' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
translations: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
value: { _eq: '@translation' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
webhooks: { | ||
onQuery: (query, client) => { | ||
query.filter = { | ||
...query.filter, | ||
name: { _eq: '@webhook' }, | ||
}; | ||
return query; | ||
}, | ||
}, | ||
}, | ||
}; |
17 changes: 17 additions & 0 deletions
17
packages/e2e/configs/on-save-duplicate/directus-sync.config.cjs
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,17 @@ | ||
const duplicate = (items) => [...items, ...items]; | ||
|
||
module.exports = { | ||
hooks: { | ||
dashboards: { onDump: duplicate, onSave: duplicate }, | ||
flows: { onDump: duplicate, onSave: duplicate }, | ||
folders: { onDump: duplicate, onSave: duplicate }, | ||
operations: { onDump: duplicate, onSave: duplicate }, | ||
panels: { onDump: duplicate, onSave: duplicate }, | ||
roles: { onDump: duplicate, onSave: duplicate }, | ||
permissions: { onDump: duplicate, onSave: duplicate }, | ||
presets: { onDump: duplicate, onSave: duplicate }, | ||
settings: { onDump: duplicate, onSave: duplicate }, | ||
translations: { onDump: duplicate, onSave: duplicate }, | ||
webhooks: { onDump: duplicate, onSave: duplicate }, | ||
}, | ||
}; |
Oops, something went wrong.