Bugzilla – Attachment 183377 Details for
Bug 40181
Cypress tests - Ensure that insertData does not leave data in the DB
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40181: Make sure data won't be added by insertData
Bug-40181-Make-sure-data-wont-be-added-by-insertDa.patch (text/plain), 2.51 KB, created by
Jonathan Druart
on 2025-06-19 10:53:27 UTC
(
hide
)
Description:
Bug 40181: Make sure data won't be added by insertData
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-06-19 10:53:27 UTC
Size:
2.51 KB
patch
obsolete
>From e7b98cf44bbfe4b108ed4894cef42275a4ebeaac Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 18 Jun 2025 14:20:29 +0200 >Subject: [PATCH] Bug 40181: Make sure data won't be added by insertData > >We are here testing that data inserted by insertData tasks can be easily >removed from the DB using deleteSampleObjects > >Test plan: >Cypress test t/cypress/integration/t/insertData.ts must pass >--- > t/cypress/integration/t/insertData.ts | 46 +++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > >diff --git a/t/cypress/integration/t/insertData.ts b/t/cypress/integration/t/insertData.ts >index b5ba8cae406..69a45c84644 100644 >--- a/t/cypress/integration/t/insertData.ts >+++ b/t/cypress/integration/t/insertData.ts >@@ -7,6 +7,32 @@ const { APIClient } = require("./../../plugins/dist/api-client.cjs.js"); > let client = APIClient.default; > > describe("insertData", () => { >+ >+ let tablesToCheck = [ >+ "borrowers", >+ "branches", >+ "items", >+ "biblio", >+ "reserves", >+ ]; >+ beforeEach(() => { >+ const counts = {}; >+ >+ const queries = tablesToCheck.map(table => { >+ return cy >+ .task("query", { >+ sql: `SELECT COUNT(*) as count FROM ${table}`, >+ }) >+ .then(result => { >+ counts[table] = result[0].count; >+ }); >+ }); >+ >+ cy.wrap(Promise.all(queries)).then(() => { >+ cy.wrap(counts).as("initialCounts"); >+ }); >+ }); >+ > describe("insertSampleBiblio", () => { > it("should generate library and item type", () => { > cy.task("insertSampleBiblio", { item_count: 3 }).then(objects => { >@@ -175,4 +201,24 @@ describe("insertData", () => { > ); > }); > }); >+ >+ afterEach(function () { >+ cy.get("@initialCounts").then(initialCounts => { >+ const queries = tablesToCheck.map(table => { >+ return cy >+ .task("query", { >+ sql: `SELECT COUNT(*) as count FROM ${table}`, >+ }) >+ .then(result => { >+ const finalCount = result[0].count; >+ expect( >+ finalCount, >+ `Row count for ${table} should match` >+ ).to.eq(initialCounts[table]); >+ }); >+ }); >+ >+ return Promise.all(queries); >+ }); >+ }); > }); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40181
: 183377