Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: failed unit test and CI test #134

Closed
wants to merge 17 commits into from
Closed
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
28 changes: 17 additions & 11 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches:
- next
- fix/decode-jwt
workflow_dispatch:

jobs:
test_and_build:
Expand Down Expand Up @@ -31,17 +33,21 @@ jobs:
- name: Check linting
run: yarn lint

- name: Build
run: yarn build

- name: Run tests
run: |
yarn jest --changedSince=origin/next --ci --json --coverage --testLocationInResults --outputFile=report.json

- name: Coverage
uses: artiomtr/jest-coverage-report-action@v2
yarn test:coverage
- run: cat coverage/coverage-final.json
- name: Jest Coverage Comment
uses: MishaKav/jest-coverage-comment@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage-file: report.json
base-coverage-file: report.json
threshold: 80

- name: Build
run: yarn build
title: Code Coverage Report
multiple-files: |
All packages, ./coverage/coverage-summary.json
Components, ./packages/components/coverage/coverage-summary.json
Mock app, ./packages/mock-app/coverage/coverage-summary.json
Services, ./packages/services/coverage/coverage-summary.json
UNTP test suite, ./packages/untp-test-suite/coverage/coverage-summary.json
VC test suite, ./packages/vc-test-suite/coverage/coverage-summary.json
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ tmp/
# logs
/logs
packages/services/tsconfig.tsbuildinfo
packages/mock-app/src/constants/app-config.json
packages/untp-test-suite/credentials.json
packages/untp-test-suite/data
# vc-test-suite
Expand Down
30 changes: 15 additions & 15 deletions app-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
"parameters": [
{
"storageKey": "CherriesFarm_dpps",
"objectKeyPath": "/vc/credentialSubject/productIdentifier/0/identifierValue"
"objectKeyPath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue"
}
]
}
Expand Down Expand Up @@ -4604,11 +4604,11 @@
"constructData": {
"mappingFields": [
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/eventID"
},
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/epcList/index/name"
},
{
Expand Down Expand Up @@ -4748,7 +4748,7 @@
"parameters": [
{
"storageKey": "orchard_facility_transaction_event",
"objectKeyPath": "/vc/credentialSubject/eventID"
"objectKeyPath": "/decodedEnvelopedVC/credentialSubject/eventID"
}
]
}
Expand Down Expand Up @@ -5502,7 +5502,7 @@
"parameters": [
{
"storageKey": "CherriesFarm_dpps",
"objectKeyPath": "/vc/credentialSubject/productIdentifier/0/identifierValue"
"objectKeyPath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue"
}
]
}
Expand Down Expand Up @@ -5845,11 +5845,11 @@
"constructData": {
"mappingFields": [
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/eventID"
},
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/epcList/index/name"
},
{
Expand Down Expand Up @@ -5989,7 +5989,7 @@
"parameters": [
{
"storageKey": "packhouse_facility_transaction_event",
"objectKeyPath": "/vc/credentialSubject/eventID"
"objectKeyPath": "/decodedEnvelopedVC/credentialSubject/eventID"
}
]
}
Expand Down Expand Up @@ -6743,7 +6743,7 @@
"parameters": [
{
"storageKey": "CherriesFarm_dpps",
"objectKeyPath": "/vc/credentialSubject/productIdentifier/0/identifierValue"
"objectKeyPath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue"
}
]
}
Expand Down Expand Up @@ -7086,11 +7086,11 @@
"constructData": {
"mappingFields": [
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/eventID"
},
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/epcList/index/name"
},
{
Expand Down Expand Up @@ -7230,7 +7230,7 @@
"parameters": [
{
"storageKey": "fumigation_and_freight_forwarding_facility_transaction_event",
"objectKeyPath": "/vc/credentialSubject/eventID"
"objectKeyPath": "/decodedEnvelopedVC/credentialSubject/eventID"
}
]
}
Expand Down Expand Up @@ -7984,7 +7984,7 @@
"parameters": [
{
"storageKey": "CherriesFarm_dpps",
"objectKeyPath": "/vc/credentialSubject/productIdentifier/0/identifierValue"
"objectKeyPath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue"
}
]
}
Expand Down Expand Up @@ -8327,11 +8327,11 @@
"constructData": {
"mappingFields": [
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/eventID"
},
{
"sourcePath": "/vc/credentialSubject/productIdentifier/0/identifierValue",
"sourcePath": "/decodedEnvelopedVC/credentialSubject/productIdentifier/0/identifierValue",
"destinationPath": "/epcList/index/name"
},
{
Expand Down
16 changes: 12 additions & 4 deletions documentation/docs/mock-apps/components/import-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ The ImportButton component is responsible for rendering a button that allows the

### Props

| Property | Required | Description | Type |
| -------- | -------- | ------------------------------- | ------ |
| label | Yes | The label for the import button | String |
| style | No | The style for the component | Object |
| Property | Required | Description | Type |
| --------- | -------- | ----------------------------------------------------------------------------------------------------- | ------ |
| label | Yes | The label for the import button | String |
| style | No | The style for the component | Object |
| type | No | The type of data (should be 'VerifiableCredential' and 'JSON'), the default is 'VerifiableCredential' | String |
| vcOptions | No | The options for the VC data processing | Object |

#### vcOptions

| Property | Required | Description | Type |
| -------------- | -------- | -------------------------------- | ------ |
| credentialPath | Yes | The path for the credential data | String |
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ The QRCodeScannerDialogButton component is responsible for rendering a button th

### Props

| Property | Required | Description | Type |
| -------- | -------- | --------------------------- | ------ |
| style | No | The style for the component | Object |
| Property | Required | Description | Type |
| --------- | -------- | ----------------------------------------------------------------------------------------------------- | ------ |
| style | No | The style for the component | Object |
| type | No | The type of data (should be 'VerifiableCredential' and 'JSON'), the default is 'VerifiableCredential' | String |
| vcOptions | No | The options for the VC data processing | Object |

#### vcOptions

| Property | Required | Description | Type |
| -------------- | -------- | --------------------------------------------------------------------- | ------ |
| credentialPath | Yes | The path for the credential data that is fetched from the QR code URL | String |
7 changes: 7 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}', '<rootDir>/src/**/*.{js,jsx}', '!**/*.d.ts'],
coverageDirectory: '<rootDir>/coverage',
coverageReporters: ['json', 'json-summary', 'text', 'lcov'],
verbose: true,
};
87 changes: 0 additions & 87 deletions jest.config.mjs

This file was deleted.

3 changes: 1 addition & 2 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"gitRemote": "origin",
"message": "chore(release): %s [skip ci]"
}
},
"useWorkspaces": true
}
}
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
"name": "mock-app",
"version": "1.0.0",
"private": true,
"workspaces": ["packages/*"],
"workspaces": [
"packages/*"
],
"scripts": {
"start": "cp app-config.json packages/mock-app/src/constants/app-config.json && cd packages/mock-app && yarn start",
"build": "yarn build:services && yarn build:components && yarn build:untp-test-suite",
"build:services": "cd packages/services && yarn run build",
"build:components": "cd packages/components && yarn run build",
"build:untp-test-suite": "cd packages/untp-test-suite && yarn run build",
"build-clean": "rimraf --glob ./yarn.lock ./node_modules ./packages/*/tsconfig.tsbuildinfo ./packages/*/build ./packages/*/node_modules",
"test": "yarn run test:services && yarn run test:components && yarn run test:mock-app",
"test": "lerna exec -- yarn jest",
"test:coverage": "lerna exec -- yarn jest --coverage && istanbul-merge --out coverage/coverage-final.json packages/*/coverage/coverage-final.json && nyc report --temp-dir=./coverage --reporter=html --reporter=json-summary",
"test:components": "cd packages/components && yarn run test",
"test:services": "cd packages/services && yarn run test",
"test:mock-app": "cd packages/mock-app && yarn run test",
Expand Down Expand Up @@ -57,6 +60,8 @@
"node": ">= 20.12.2"
},
"dependencies": {
"rimraf": "^5.0.5"
"rimraf": "^5.0.5",
"istanbul-merge": "2.0.0",
"nyc": "17.1.0"
}
}
2 changes: 2 additions & 0 deletions packages/components/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import base from '../../jest.config.base.js';
const jestConfig = {
...base,
preset: 'ts-jest',
testEnvironment: 'jsdom',
extensionsToTreatAsEsm: ['.ts'],
Expand Down
Loading
Loading