Skip to content

Commit

Permalink
TECH-654 - added workspace argument to deleteNode
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Krasnov committed May 16, 2024
1 parent f1a4ffb commit 9219d65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions fixtures/graphql/jcr/mutation/deleteNode.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mutation deleteNode($pathOrId: String!) {
jcr(workspace: EDIT) {
mutation deleteNode($pathOrId: String!, $workspace: Workspace!) {
jcr(workspace: $workspace) {
deleteNode(pathOrId: $pathOrId)
}
}
9 changes: 6 additions & 3 deletions src/utils/JCRHelper.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
type Workspace = 'EDIT' | 'LIVE';

export const setNodeProperty = (pathOrId: string, property: string, value: string | Array<string>, language: string): Cypress.Chainable => {
let mutationFile = 'graphql/jcr/mutation/setProperty.graphql';
if (value instanceof Array) {
Expand All @@ -15,10 +17,11 @@ export const setNodeProperty = (pathOrId: string, property: string, value: strin
});
};

export const deleteNode = (pathOrId: string): Cypress.Chainable => {
export const deleteNode = (pathOrId: string, workspace: Workspace = 'EDIT'): Cypress.Chainable => {
return cy.apollo({
variables: {
pathOrId: pathOrId
pathOrId: pathOrId,
workspace
},
mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
});
Expand All @@ -43,7 +46,7 @@ export const addNode = (variables: { parentPathOrId: string, primaryNodeType: st
});
};

export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: 'EDIT' | 'LIVE' = 'EDIT'): Cypress.Chainable => {
export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: Workspace = 'EDIT'): Cypress.Chainable => {

Check warning on line 49 in src/utils/JCRHelper.ts

View workflow job for this annotation

GitHub Actions / Lint and build

Arrow function has too many parameters (5). Maximum allowed is 4
return cy.apollo({
variables: {
path: path,
Expand Down

0 comments on commit 9219d65

Please sign in to comment.