From cdc9de2c2ae114665716f813915b9ba82865ab6e Mon Sep 17 00:00:00 2001
From: MellyGray <melinaabril@gmail.com>
Date: Fri, 3 Nov 2023 11:26:57 +0100
Subject: [PATCH] feat(IntegrationDatasetPermissions): add permissions to
 DatasetRepository integration test

---
 dev.Dockerfile                                        |  1 +
 package-lock.json                                     |  8 +++++---
 package.json                                          |  5 ++++-
 .../e2e/sections/dataset/Dataset.spec.tsx             |  1 -
 .../datasets/DatasetJSDataverseRepository.spec.ts     | 11 +++++++++++
 5 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/dev.Dockerfile b/dev.Dockerfile
index 5e474faf8..fb0b8ee2e 100644
--- a/dev.Dockerfile
+++ b/dev.Dockerfile
@@ -10,6 +10,7 @@ RUN npm run build
 
 WORKDIR /usr/src/app
 COPY package.json ./
+COPY package-lock.json ./
 COPY .npmrc ./
 RUN npm install
 
diff --git a/package-lock.json b/package-lock.json
index 170dd6d0f..2abed2bfe 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5913,12 +5913,14 @@
       }
     },
     "node_modules/@parcel/watcher": {
-      "version": "2.0.4",
-      "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.0.4.tgz",
-      "integrity": "sha512-cTDi+FUDBIUOBKEtj+nhiJ71AZVlkAsQFuGQTun5tV9mwQBQgZvhCzG+URPQc8myeN32yRVZEfVAPCs1RW+Jvg==",
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.1.0.tgz",
+      "integrity": "sha512-8s8yYjd19pDSsBpbkOHnT6Z2+UJSuLQx61pCFM0s5wSRvKCEMDjd/cHY3/GI1szHIWbpXpsJdg3V6ISGGx9xDw==",
       "dev": true,
       "hasInstallScript": true,
       "dependencies": {
+        "is-glob": "^4.0.3",
+        "micromatch": "^4.0.5",
         "node-addon-api": "^3.2.1",
         "node-gyp-build": "^4.3.0"
       },
diff --git a/package.json b/package.json
index 426658d6e..450ef5b8d 100644
--- a/package.json
+++ b/package.json
@@ -164,5 +164,8 @@
     "workerDirectory": "public"
   },
   "readme": "ERROR: No README data found!",
-  "_id": "dataverse-frontend@0.1.0"
+  "_id": "dataverse-frontend@0.1.0",
+  "overrides": {
+    "@parcel/watcher": "2.1.0"
+  }
 }
diff --git a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx
index d32ea2ed2..f57ae4d7f 100644
--- a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx
+++ b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx
@@ -31,7 +31,6 @@ describe('Dataset', () => {
             // cy.findByText(DatasetLabelValue.UNPUBLISHED).should('exist') TODO - Implemnent isReleased property in js-dataverse to get the Unpublished label
 
             cy.findByRole('button', { name: 'Edit Dataset' }).should('exist')
-            cy.findByRole('button', { name: 'Upload Files' }).should('exist')
             cy.findByText('Metadata').should('exist')
             cy.findByText('Files').should('exist')
           })
diff --git a/tests/e2e-integration/integration/datasets/DatasetJSDataverseRepository.spec.ts b/tests/e2e-integration/integration/datasets/DatasetJSDataverseRepository.spec.ts
index 480456aeb..3ddac7fb8 100644
--- a/tests/e2e-integration/integration/datasets/DatasetJSDataverseRepository.spec.ts
+++ b/tests/e2e-integration/integration/datasets/DatasetJSDataverseRepository.spec.ts
@@ -79,6 +79,14 @@ const datasetData = (persistentId: string, versionId: number) => {
       latestVersionStatus: 'draft',
       isLatest: true,
       isInReview: false
+    },
+    permissions: {
+      canDownloadFiles: true,
+      canUpdateDataset: true,
+      canPublishDataset: true,
+      canManageDatasetPermissions: true,
+      canManageFilesPermissions: true,
+      canDeleteDataset: true
     }
   }
 }
@@ -106,6 +114,7 @@ describe('Dataset JSDataverse Repository', () => {
       expect(dataset.version).to.deep.equal(datasetExpected.version)
       expect(dataset.metadataBlocks[0].fields.publicationDate).not.to.exist
       expect(dataset.metadataBlocks[0].fields.citationDate).not.to.exist
+      expect(dataset.permissions).to.deep.equal(datasetExpected.permissions)
     })
   })
 
@@ -138,6 +147,7 @@ describe('Dataset JSDataverse Repository', () => {
           expectedPublicationDate
         )
         expect(dataset.metadataBlocks[0].fields.citationDate).not.to.exist
+        expect(dataset.permissions).to.deep.equal(datasetExpected.permissions)
       })
   })
 
@@ -169,6 +179,7 @@ describe('Dataset JSDataverse Repository', () => {
 
       expect(dataset.getTitle()).to.deep.equal(datasetExpected.title)
       expect(dataset.version).to.deep.equal(datasetExpected.version)
+      expect(dataset.permissions).to.deep.equal(datasetExpected.permissions)
     })
   })