Skip to content

Fix integration test CREATE USER statement #1069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2023
Merged
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
14 changes: 11 additions & 3 deletions packages/neo4j-driver/test/rx/summary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import neo4j from '../../src'
import neo4j, { Neo4jError } from '../../src'
// eslint-disable-next-line no-unused-vars
import RxSession from '../../src/session-rx'
// eslint-disable-next-line no-unused-vars
Expand Down Expand Up @@ -344,15 +344,23 @@ describe('#integration-rx summary', () => {
runnable = await session.beginTransaction().toPromise()
}

let dropUser = true

try {
await verifySystemUpdates(
runnable,
"CREATE USER foo SET PASSWORD 'bar'",
"CREATE USER foo SET PASSWORD 'barizon1'",
{},
1
)
} catch (e) {
// the user should not be dropped if their creation fails
dropUser = !(e instanceof Neo4jError)
throw e
} finally {
await verifySystemUpdates(runnable, 'DROP USER foo', {}, 1)
if (dropUser) {
await verifySystemUpdates(runnable, 'DROP USER foo', {}, 1)
}
}
}

Expand Down