Skip to content
Draft
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions test-suite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# How to run against openBIS test instance

```console
export API_KEY=<Your API key>
npm run test:openbis
```

# How to run against SciCat test instance (you IP address needs to be whitelisted)

```console
export API_KEY=<Your API key>
npm run test:scicat
```
151 changes: 151 additions & 0 deletions test-suite/crates/one-publication.psi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"@context": {
"Organization": "https://schema.org/Organization",
"owl": "http://www.w3.org/2002/07/owl#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"CreativeWork": "https://schema.org/CreativeWork",
"about": "https://schema.org/about",
"description": "https://schema.org/description",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"dateCreated": "https://schema.org/dateCreated",
"rangeIncludes": "https://schema.org/rangeIncludes",
"creativeWorkStatus": "https://schema.org/creativeWorkStatus",
"identifier": "https://schema.org/identifier",
"creator": "https://schema.org/creator",
"hasPart": "https://schema.org/hasPart",
"Dataset": "https://schema.org/Dataset",
"dateModified": "https://schema.org/dateModified",
"abstract": "https://schema.org/abstract",
"sdDatePublished": "https://schema.org/sdDatePublished",
"domainIncludes": "https://schema.org/domainIncludes",
"datePublished": "https://schema.org/datePublished",
"license": "https://schema.org/license",
"additionalType": "https://schema.org/additionalType",
"name": "https://schema.org/name",
"publisher": "https://schema.org/publisher",
"conformsTo": "http://purl.org/dc/terms/conformsTo",
"Person": "https://schema.org/Person"
},
"@graph": [
{
"@id": "./",
"@type": "Dataset",
"name": "A test pub made of 3 ds",
"description": "3 ds",
"license": {
"@id": "https://creativecommons.org/licenses/by-sa/4.0/"
},
"datePublished": "2023-01-01",
"hasPart": [
{
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fmaxiv_ds2"
},
{
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fsoleil_ds2"
},
{
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fukri_ds5"
},
{
"@id": "https://doi.org/10.16907/d910159a-d48a-45fb-acf2-74b27cd5a8e5"
}
]
},
{
"about": {
"@id": "./"
},
"conformsTo": {
"@id": "https://w3id.org/ro/crate/1.1"
},
"@id": "ro-crate-metadata.json",
"@type": "CreativeWork"
},
{
"name": "Tests_Carto.tar",
"description": "",
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fsoleil_ds2",
"@type": "Dataset"
},
{
"name": "files.zip",
"description": "",
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fmaxiv_ds2",
"@type": "Dataset"
},
{
"name": "raw",
"description": "",
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fukri_ds5",
"@type": "Dataset"
},
{
"identifier": "10.16907/d910159a-d48a-45fb-acf2-74b27cd5a8e5",
"creator": [
{
"@id": "f04f73c1-c916-4544-9b71-a79ce20bee2f"
},
{
"@id": "03f8187a-9397-4c92-bfda-01b02ca73930"
},
{
"@id": "9df3f9b3-893d-4636-9308-122ac4c10284"
}
],
"publisher": {
"@id": "https://ror.org/03eh3y714"
},
"license": {
"@id": "https://creativecommons.org/licenses/by-sa/4.0/"
},
"datePublished": "2023",
"name": "A test pub made of 3 ds",
"abstract": "3 ds",
"additionalType": "raw",
"sdDatePublished": "2023-01-26T13:02:38.341Z",
"creativeWorkStatus": "REGISTERED",
"dateCreated": "2023-01-26T13:02:13.639Z",
"dateModified": "2023-01-26T13:02:13.643Z",
"description": "3 ds",
"hasPart": [
{
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fsoleil_ds2"
},
{
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fmaxiv_ds2"
},
{
"@id": "http://backend.scicat-development/datasets/PID.SAMPLE.PREFIX%2Fukri_ds5"
}
],
"@id": "https://doi.org/10.16907/d910159a-d48a-45fb-acf2-74b27cd5a8e5",
"@type": "CreativeWork"
},
{
"name": "Paul Scherrer Institute",
"@id": "https://ror.org/03eh3y714",
"@type": "Organization"
},
{
"name": "Doru Constantin",
"@id": "f04f73c1-c916-4544-9b71-a79ce20bee2f",
"@type": "Person"
},
{
"identifier": "https://creativecommons.org/licenses/by-sa/4.0/",
"name": "Creative Commons Attribution Share Alike 4.0 International",
"@id": "https://creativecommons.org/licenses/by-sa/4.0/",
"@type": "CreativeWork"
},
{
"name": "Maik Kahnt",
"@id": "03f8187a-9397-4c92-bfda-01b02ca73930",
"@type": "Person"
},
{
"name": "Gabriel Bernardo",
"@id": "9df3f9b3-893d-4636-9308-122ac4c10284",
"@type": "Person"
}
]
}
1 change: 1 addition & 0 deletions test-suite/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const config: Config = {
preset: 'ts-jest',
testEnvironment: 'node',
rootDir: './src',
testTimeout: 15 * 1000,
};

export default config;
110 changes: 12 additions & 98 deletions test-suite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions test-suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.0.0",
"scripts": {
"test": "jest",
"test:openbis": "NODE_TLS_REJECT_UNAUTHORIZED=0 BASE_URL=https://openbis-sis-ci-sprint-public.ethz.ch/ro-crate-server jest",
"test:psi": "BASE_URL=https://scicat-exporter.development.psi.ch/api/v1/ro-crate jest",
"test:openbis": "NODE_TLS_REJECT_UNAUTHORIZED=0 TEST_ENV=OPENBIS jest",
"test:psi": "TEST_ENV=PSI jest",
"lint": "eslint . --ext .ts"
},
"devDependencies": {
Expand All @@ -24,6 +24,7 @@
},
"dependencies": {
"@types/node": "^24.3.1",
"@zip.js/zip.js": "^2.8.10",
"ts-node": "^10.9.2"
}
}
15 changes: 14 additions & 1 deletion test-suite/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
export const BASE_URL = process.env.BASE_URL || 'http://localhost:8080';
export enum TestingEnv {
PSI = 'https://scicat-exporter.development.psi.ch/api/v1/ro-crate',
OPENBIS = 'https://openbis-sis-ci-sprint-public.ethz.ch/ro-crate-server',
}

const testEnv = process.env.TEST_ENV || '';
if (!Object.keys(TestingEnv).includes(testEnv)) {
throw new Error(
`Invalid TEST_ENV value: ${testEnv}. Must be either 'PSI' or 'OPENBIS'.`
);
}

export const BASE_URL = TestingEnv[testEnv as keyof typeof TestingEnv];

export const API_KEY = process.env.API_KEY || '';
Loading