Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions e2e_tests/integration/auto-prefix.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ describe(':auto prefix in browser', () => {
cy.getFrames().should('not.contain', 'ERROR')
cy.getFrames().contains('Started streaming 1 rec')
})

it('newline is allowed after :auto', () => {
cy.executeCommand(':clear')
cy.executeCommand(
`:auto{shift}{enter}CALL {{} RETURN 2 as x {}} IN TRANSACTIONS RETURN 2;`
)
cy.getFrames().should('not.contain', 'ERROR')
cy.getFrames().contains('Started streaming 1 rec')
})
}

it('can use :auto command in multi-statements', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/modules/commands/cypher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('Implicit vs explicit transactions', () => {
flushPromises().then(() => {
expect(bolt.routedWriteTransaction).toHaveBeenCalledTimes(1)
expect(bolt.routedWriteTransaction).toHaveBeenCalledWith(
'RETURN 1',
' RETURN 1',
{},
expect.objectContaining({
autoCommit: true
Expand Down Expand Up @@ -163,7 +163,7 @@ multiline comment
// comment

// comment
/*:auto*/RETURN ":auto"`,
/*:auto*/ RETURN ":auto"`,
{},
expect.objectContaining({
autoCommit: true
Expand Down
2 changes: 1 addition & 1 deletion src/shared/services/commandInterpreterHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ const availableCommands = [
// we need to strip that and attach to the actions object
const query = action.cmd.trim()

const autoPrefix = `:${autoCommitTxCommand} `
const autoPrefix = `:${autoCommitTxCommand}`
const blankedComments = query
.replace(/\/\*(.|\n)*?\*\//g, (match: any) => ' '.repeat(match.length)) // mutliline comment
.replace(/\/\/[^\n]*\n/g, (match: any) => ' '.repeat(match.length)) // singleline comment
Expand Down