Skip to content

Commit

Permalink
feat(integration): verifications tests (#86)
Browse files Browse the repository at this point in the history
* feat: remove outdated /domain/authorizations code

* chore(deps): update dependencies, run npm audit fix

* chore(types): update local types with api-snippets versions

* chore(types): update local types with api-snippets versions

* chore(types): update local types with api-snippets versions

* chore(refactor): remove unused code

* feat(int): add integration test

* fix: update interface to fix bad payload errors

* chore: switch to updated api-snippets

* chore: switch to updated api-snippets

* fix: thirdpartyRequestsVerifications tests

* fix(vulns): run npm audit, ignore irrelevant vulns for 1 month

* fix(api): update to latest API-Snippets to fix payload issue
  • Loading branch information
lewisdaly authored Aug 16, 2021
1 parent e2edfb0 commit 88e1ca3
Show file tree
Hide file tree
Showing 20 changed files with 340 additions and 716 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ jobs:
command: |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
docker-compose up -d
chmod +x ./scripts/wait4.js
sh -c "./scripts/wait4.js cicd-integration-tests"
./scripts/wait4.js cicd-integration-tests
environment:
NODE_ENV: "integration"
- run:
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
FROM node:12.16.1-alpine as builder

USER root

WORKDIR /opt/auth-service

RUN apk add --no-cache -t build-dependencies git make gcc g++ python libtool autoconf automake \
&& cd $(npm root -g)/npm \
&& npm config set unsafe-perm true \
&& npm install -g node-gyp

COPY package.json package-lock.json* /opt/auth-service/

RUN npm ci

COPY . /opt/auth-service

FROM node:12.16.1-alpine

WORKDIR /opt/auth-service

# Create empty log file & link stdout to the application log file
RUN mkdir ./logs && touch ./logs/combined.log
RUN ln -sf /dev/stdout ./logs/combined.log

# Create a non-root user: as-user
RUN adduser -D as-user
USER as-user
COPY --chown=as-user --from=builder /opt/auth-service .

# cleanup
# disable prune, breaks tests
# RUN npm prune --production
Expand Down
16 changes: 8 additions & 8 deletions audit-resolve.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@
},
"1770|sqlite3>node-gyp>tar": {
"decision": "ignore",
"madeAt": 1628474128361,
"expiresAt": 1629078919753
"madeAt": 1629080956000,
"expiresAt": 1631672938643
},
"1770|sqlite3>node-pre-gyp>tar": {
"decision": "ignore",
"madeAt": 1628474128361,
"expiresAt": 1629078919753
"madeAt": 1629080956000,
"expiresAt": 1631672938643
},
"1771|sqlite3>node-gyp>tar": {
"decision": "ignore",
"madeAt": 1628474128361,
"expiresAt": 1629078919753
"madeAt": 1629080956000,
"expiresAt": 1631672938643
},
"1771|sqlite3>node-pre-gyp>tar": {
"decision": "ignore",
"madeAt": 1628474128361,
"expiresAt": 1629078919753
"madeAt": 1629080956000,
"expiresAt": 1631672938643
}
},
"rules": {},
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
interval: 30s

redis:
container_name: redis
container_name: as_redis
image: "redis:6.2.4-alpine"
networks:
- mojaloop-net
Expand All @@ -62,7 +62,7 @@ services:

ml-testing-toolkit:
image: mojaloop/ml-testing-toolkit:v12.4.0
container_name: ml-testing-toolkit
container_name: as_ml-testing-toolkit
volumes:
- "./docker/ml-testing-toolkit/spec_files:/opt/mojaloop-testing-toolkit/spec_files"
- "./docker/ml-testing-toolkit/secrets:/opt/mojaloop-testing-toolkit/secrets"
Expand All @@ -77,7 +77,7 @@ services:

ml-testing-toolkit-ui:
image: mojaloop/ml-testing-toolkit-ui:v12.0.0
container_name: ml-testing-toolkit-ui
container_name: as_ml-testing-toolkit-ui
ports:
- "6060:6060"
command: nginx -g "daemon off;"
Expand All @@ -89,6 +89,6 @@ services:

mongo:
image: mongo
container_name: 3p_mongo
container_name: as_mongo
ports:
- "27017:27017"
30 changes: 24 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"@hapi/hapi": "^20.1.5",
"@hapi/inert": "^6.0.3",
"@hapi/vision": "^6.1.0",
"@mojaloop/api-snippets": "^12.4.6",
"@mojaloop/api-snippets": "^12.6.2",
"@mojaloop/central-services-error-handling": "11.3.0",
"@mojaloop/central-services-health": "^13.0.0",
"@mojaloop/central-services-logger": "10.6.1",
Expand Down
42 changes: 0 additions & 42 deletions src/domain/auth-payload.ts

This file was deleted.

133 changes: 0 additions & 133 deletions src/domain/authorizations.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/domain/fido-credential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export async function validateAttestation (
}

export async function validate (
credential: tpAPI.Schemas.FIDOPublicKeyCredential
credential: tpAPI.Schemas.FIDOPublicKeyCredentialAttestation
): Promise<boolean> {
const { response, type } = credential
const { clientDataJSON, attestationObject } = response
Expand Down
3 changes: 1 addition & 2 deletions src/domain/stateMachine/verifyTransaction.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
thirdparty as tpAPI
} from '@mojaloop/api-snippets'
import { PubSub } from '~/shared/pub-sub'
import { ThirdpartyRequestsVerificationsPostRequest } from '~/server/handlers/thirdpartyRequestsVerifications'

export interface VerifyTransactionStateMachine extends ControlledStateMachine {
retreiveConsent: Method
Expand All @@ -58,7 +57,7 @@ export interface VerifyTransactionData extends StateData {
participantDFSPId: string

// initial POST /thirdpartyRequests/verifications request
verificationRequest: ThirdpartyRequestsVerificationsPostRequest
verificationRequest: tpAPI.Schemas.ThirdpartyRequestsVerificationsPostRequest

errorInformation?: tpAPI.Schemas.ErrorInformation
}
Loading

0 comments on commit 88e1ca3

Please sign in to comment.