add initial integration tests

Integration tests are executed using vue-cli-service with double quotes as following: `vue-cli-service test:unit "tests/integration/**/*.spec.ts"`. Using single quotes (mochajs/mocha#1828) works on macOS and Ubuntu but does not on Windows (tests are not found). Double quotes is the only portable way that works on all three platforms (mochajs/mocha#3136).
This commit is contained in:
undergroundwires
2021-05-03 15:48:01 +02:00
parent eb9ac35a92
commit 49600c5f37
9 changed files with 20607 additions and 32 deletions

View File

@@ -26,7 +26,9 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:unit
run: |
npm run test:unit
npm run test:integration
- name: Publish desktop app
run: npm run electron:build -- -p always # https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/recipes.html#upload-release-to-github
env:

View File

@@ -90,7 +90,9 @@ jobs:
working-directory: site
-
name: "App: Run tests"
run: npm run test:unit
run: |
npm run test:unit
npm run test:integration
working-directory: site
-
name: "App: Build"

View File

@@ -22,5 +22,8 @@ jobs:
name: Install dependencies
run: npm ci
-
name: Run tests
name: Run unit tests
run: npm run test:unit
-
name: Run integration tests
run: npm run test:integration

View File

@@ -45,6 +45,7 @@
- Project setup: `npm install`
- Testing
- Run unit tests: `npm run test:unit`
- Run integration tests: `npm run test:integration`
- Lint: `npm run lint`
- **Desktop app**
- Development: `npm run electron:serve`

View File

@@ -1,10 +1,14 @@
# Tests
- There are two different types of tests executed:
1. [Unit tests](#unit-tests)
2. [Integration tests](#integration-tests)
- 💡 You can use path/module alias `@/tests` in import statements.
## Unit tests
- Unit tests are defined in [`./tests`](./../tests)
- Tests each component in isolation
- Defined in [`./tests/unit`](./../tests/unit)
- They follow same folder structure as [`./src`](./../src)
### Naming
@@ -31,3 +35,9 @@
- Stubs are defined in [`./tests/stubs`](./../tests/unit/stubs)
- They implement dummy behavior to be functional
## Integration tests
- Tests functionality of a component in combination with others (not isolated)
- Ensure dependencies to third parties work as expected
- Defined in [`./tests/integration`](./../tests/integration)

20590
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"test:integration": "vue-cli-service test:unit \"tests/integration/**/*.spec.ts\"",
"lint": "npm run lint:vue && npm run lint:yaml && npm run lint:md && npm run lint:md:relative-urls && npm run lint:md:consistency",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",

View File

@@ -0,0 +1,14 @@
import 'mocha';
import { expect } from 'chai';
import { parseApplication } from '@/application/Parser/ApplicationParser';
describe('ApplicationParser', () => {
describe('parseApplication', () => {
it('can parse current application', () => {
// act
const act = () => parseApplication();
// assert
expect(act).to.not.throw();
});
});
});

View File

@@ -16,12 +16,6 @@ import { CollectionDataStub } from '@tests/unit/stubs/CollectionDataStub';
describe('ApplicationParser', () => {
describe('parseApplication', () => {
it('can parse current application', () => { // Integration test
// act
const act = () => parseApplication();
// assert
expect(act).to.not.throw();
});
describe('parser', () => {
it('returns result from the parser', () => {
// arrange