Page MenuHomeSoftware Heritage
Paste P1130

vault.spec.js: Remove vaultItems from global variables
ActivePublic

Authored by vlorentz on Aug 24 2021, 10:52 AM.
commit 9a4422102ff79124d637b80aab0fdecfff0169e0 (HEAD -> prepare-vault)
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date: Tue Aug 24 10:19:22 2021 +0200
vault.spec.js: Remove vaultItems from global variables
So tests don't have side-effects
diff --git a/cypress/integration/vault.spec.js b/cypress/integration/vault.spec.js
index d2d6be7c..20f2db84 100644
--- a/cypress/integration/vault.spec.js
+++ b/cypress/integration/vault.spec.js
@@ -5,8 +5,6 @@
* See top-level LICENSE file for more information
*/
-const vaultItems = [];
-
const progressbarColors = {
'new': 'rgba(128, 128, 128, 0.5)',
'pending': 'rgba(0, 0, 255, 0.5)',
@@ -83,14 +81,16 @@ describe('Vault Cooking User Interface Tests', function() {
this.releaseUrl = this.Urls.browse_release(release.id) + `?origin_url=${this.origin[1].url}`;
this.vaultReleaseDirectoryUrl = this.Urls.api_1_vault_cook_directory(release.directory);
- vaultItems[0] = {
- 'object_type': 'revision',
- 'object_id': this.revision,
- 'email': '',
- 'status': 'done',
- 'fetch_url': `/api/1/vault/revision/${this.revision}/gitfast/raw/`,
- 'progress_message': null
- };
+ this.vaultItems = [
+ {
+ 'object_type': 'revision',
+ 'object_id': this.revision,
+ 'email': '',
+ 'status': 'done',
+ 'fetch_url': `/api/1/vault/revision/${this.revision}/gitfast/raw/`,
+ 'progress_message': null
+ }
+ ];
});
beforeEach(function() {
@@ -366,7 +366,7 @@ describe('Vault Cooking User Interface Tests', function() {
it('should offer to recook an archive if no more available to download', function() {
- updateVaultItemList(this.Urls.browse_vault(), vaultItems);
+ updateVaultItemList(this.Urls.browse_vault(), this.vaultItems);
// Send 404 when fetching vault item
cy.intercept({url: this.vaultFetchRevisionUrl}, {
@@ -406,7 +406,7 @@ describe('Vault Cooking User Interface Tests', function() {
it('should remove selected vault items', function() {
- updateVaultItemList(this.Urls.browse_vault(), vaultItems);
+ updateVaultItemList(this.Urls.browse_vault(), this.vaultItems);
cy.get(`#vault-task-${this.revision}`)
.find('input[type="checkbox"]')