added new test reference to anon database and made a deletion test

This commit is contained in:
juhanikat
2025-05-27 15:57:46 +03:00
parent 9b0c74f56e
commit 4965138cd0
2 changed files with 11 additions and 10 deletions
+7 -8
View File
@@ -9,7 +9,7 @@ describe('Creating a reference', () => {
it.skip('with valid data works', () => {})
it.skip('with missing required fields does no work', () => {})
it.skip('with missing required fields does not work', () => {})
// TODO: add more tests for different types of references etc.
})
@@ -21,7 +21,7 @@ describe('Editing a reference', () => {
it.skip('with valid data works', () => {})
it.skip('with missing required fields does no work', () => {})
it.skip('with missing required fields does not work', () => {})
// TODO: add more tests for different types of references etc.
})
@@ -31,9 +31,8 @@ describe('Deleting a reference', () => {
cy.login('testSu')
})
it.skip('that is not linked to anything works and returns user to table view', () => {
// TODO: Create a new reference in anon database that is not linked to any localities or species
cy.visit('/reference/<reference_id>')
it('that is not linked to anything works and returns user to table view', () => {
cy.visit('/reference/25000')
cy.get('[id=delete-button]').should('exist').click()
cy.on('window:confirm', str => {
expect(str).to.eq('Are you sure you want to delete this item? This operation cannot be undone.')
@@ -41,12 +40,12 @@ describe('Deleting a reference', () => {
})
cy.contains('Deleted item successfully.')
cy.contains('Dated co-occurrence of Homo erectus and Gigantopithecus from Tham Khuyen Cave, Vietnam') // check that table view has been navigated to
cy.contains('<Deleted reference title>').should('not.exist')
cy.visit('/reference/<reference_id>')
cy.contains('A test reference that is not linked to any localities or species').should('not.exist')
cy.visit('/reference/25000')
cy.contains('Error loading data')
})
// Skipped because referecnes that have linked localities or species cannot be deleted currently.
// Skipped because references that have linked localities or species cannot be deleted currently
it.skip('that is linked to a locality and a species works and returns user to table view', () => {
cy.visit('/reference/10039')
cy.get('[id=delete-button]').should('exist').click()
+4 -2
View File
@@ -1709,7 +1709,8 @@ INSERT INTO `ref_authors` VALUES
(21368,2,1,'Ciochon','Russell'),
(24151,2,1,'Ogg','J.G.'),
(24187,2,1,'Kaakinen','A.'),
(24188,2,1,'Wang','X.');
(24188,2,1,'Wang','X.'),
(25000,2,1,'Doe','D.');
/*!40000 ALTER TABLE `ref_authors` ENABLE KEYS */;
UNLOCK TABLES;
@@ -2198,7 +2199,8 @@ INSERT INTO `ref_ref` VALUES
(21368,1,100,'Dated co-occurrence of Homo erectus and Gigantopithecus from Tham Khuyen Cave, Vietnam',1996,'93',NULL,3016,3020,NULL,NULL,NULL,NULL,NULL,NULL,'abstract','http://www.pnas.org/cgi/reprint/93/7/3016',NULL,NULL,NULL,'English',NULL,NULL,1,NULL),
(24151,2,NULL,'A Concise Geologic Time Scale: 2016',2016,NULL,NULL,NULL,240,'Elsevier',NULL,NULL,NULL,NULL,'9780444594686',NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0),
(24187,13,NULL,'Helsinki Asian time update',2020,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2020-01-29',NULL,1,NULL),
(24188,2,NULL,'Fossil Mammals of Asia',2013,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL);
(24188,2,NULL,'Fossil Mammals of Asia',2013,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL),
(25000,1,100,'A test reference that is not linked to any localities or species',2025,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `ref_ref` ENABLE KEYS */;
UNLOCK TABLES;