WSL/SLF GitLab Repository

Commit 88be4f9e authored by Dominik Haas's avatar Dominik Haas
Browse files

refactor(unit-testing): added vitest; removed jest; started with changing of...

refactor(unit-testing): added vitest; removed jest; started with changing of the first tests to run via vitest
parent 7b7ac9c9
This diff is collapsed.
......@@ -9,7 +9,9 @@
"serve-debug": "vite --debug",
"build": "vite build",
"preview": "vite preview --host 0.0.0.0 --port 8080",
"test": "jest",
"test": "vitest",
"test-dev": "vitest watch",
"coverage": "vitest run --coverage",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"extract-authors": "node src/node/extractAuthors.js",
......@@ -17,7 +19,6 @@
"full-build": "vite build && build-storybook",
"storybook": "start-storybook -p 6006 --loglevel warn",
"storybook-debug": "start-storybook -p 6006 --loglevel silly",
"test:debug": "node --inspect-brk=9229 ./node_modules/.bin/jest --no-cache --runInBand",
"build-storybook": "build-storybook"
},
"dependencies": {
......@@ -70,7 +71,7 @@
"@storybook/testing-library": "^0.0.13",
"@storybook/vue": "^6.5.12",
"@vitejs/plugin-vue2": "^2.0.0",
"@vue/test-utils": "^1.1.2",
"@vitest/ui": "^0.24.3",
"babel-loader": "^8.2.5",
"chromatic": "^6.0.4",
"eslint": "^8.20.0",
......@@ -82,7 +83,6 @@
"eslint-plugin-storybook": "^0.6.1",
"eslint-plugin-vue": "^9.2.0",
"eslint-plugin-vuetify": "^1.1.0",
"jest": "^24.9.0",
"prettier": "^1.16.4",
"prism-react-renderer": "^0.1.7",
"prismjs": "^1.27.0",
......@@ -92,6 +92,7 @@
"vite-plugin-cesium": "^1.2.19",
"vite-plugin-eslint": "^1.7.0",
"vite-plugin-static-copy": "^0.9.0",
"vitest": "^0.24.3",
"vuetify-loader": "^1.9.2"
},
"browserslist": [
......
/* eslint-disable no-unused-vars,no-unused-expressions */
import { describe, expect, it } from 'vitest';
import {
createHeader,
createBody,
createFunding,
createCitation,
createDetails,
createFunding,
createHeader,
createLicense,
createLocation,
createPublications,
createDetails,
createResource,
enhanceTags,
formatDate,
enhanceTitleImg,
formatDate,
} from '@/factories/metaDataFactory';
import packagelist from '@/../public/testdata/packagelist.json';
import categoryCards from '@/store/categoryCards';
import packagelist from '../../stories/testdata/packagelist.json';
// const metadatasContent = {};
// packagelist.result.forEach((entry) => {
// metadatasContent[entry.id] = entry;
// });
describe('metaDataFactory - createHeader', () => {
it('empty', () => {
const header = createHeader(undefined);
expect(header).toBeNull();
expect(header).to.be.null;
});
it('with dataset', () => {
it.concurrent('with dataset', () => {
const dataset = packagelist.result[2];
const header = createHeader(dataset);
expect(header).toBeDefined();
expect(header.metadataTitle).toBeDefined();
expect(header.doi).toBeDefined();
expect(header.contactName).toBeDefined();
expect(header.contactEmail).toBeDefined();
expect(header.license).toBeDefined();
expect(header.tags).toBeDefined();
expect(header.titleImg).toBe(dataset.titleImg);
expect(header.maxTags).toBeDefined();
expect(header.authors).toBeDefined();
expect(header).to.have.property('metadataTitle');
expect(header).to.have.property('doi');
expect(header).to.have.property('contactName');
expect(header).to.have.property('license');
expect(header).to.have.property('tags');
expect(header.tags).to.be.an('array');
expect(header.tags).to.have.lengthOf.at.least(5);
expect(header).to.have.property('titleImg');
expect(header).to.have.property('maxTags');
expect(header).to.have.property('authors');
expect(header.authors).to.be.an('array');
expect(header.authors).to.have.lengthOf.at.least(1);
});
});
describe('metaDataFactory - createBody', () => {
it('empty', () => {
const body = createBody(undefined);
expect(body).toBeNull();
expect(body).to.be.null;
});
it('with dataset', () => {
it.concurrent('with dataset', () => {
const dataset = packagelist.result[3];
const body = createBody(dataset);
......@@ -72,6 +81,7 @@ describe('metaDataFactory - createBody', () => {
});
});
/*
describe('metaDataFactory - createFunding', () => {
it('empty', () => {
const funding = createFunding(undefined);
......@@ -304,3 +314,4 @@ describe('metaDataFactory - formatDate', () => {
expect(date).toBe('15. Aug 2017 15:25');
});
});
*/
......@@ -44,7 +44,7 @@ export default ({ mode }) => {
}
}
console.log(`starting server | version: ${version} | prod: ${isProd}`);
console.log(`starting server | version: ${version} | mode: ${mode}`);
return defineConfig({
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment