From e226098c4d0da8b43c519bab1ddad3443ef00aba Mon Sep 17 00:00:00 2001 From: Pierre Troger Date: Thu, 10 Oct 2024 14:44:29 +0200 Subject: [PATCH 1/7] moved sdk e2e tests to separate package --- packages/user-journey/.eslintrc.json | 18 +++++++++ packages/user-journey/Makefile | 37 +++++++++++++++++++ packages/user-journey/README.md | 3 ++ packages/user-journey/jest.config.ts | 18 +++++++++ packages/user-journey/jest.e2e.ts | 9 +++++ packages/user-journey/package.json | 10 +++++ packages/user-journey/project.json | 21 +++++++++++ .../e2e/criterion/check-approvals.spec.ts | 0 .../e2e/criterion/check-rate-limit.spec.ts | 6 +-- .../criterion/check-spending-limit.spec.ts | 0 .../scenarii/address-book-management.spec.ts | 6 +-- .../approvals-and-spending-limit.spec.ts | 6 +-- .../e2e/scenarii/defi-interactions.spec.ts | 8 ++-- .../tiered-eth-transfer-policy.spec.ts | 0 .../e2e/scenarii/user-journeys.spec.ts | 0 .../resource/entity/defi-interaction.json | 0 .../src}/resource/entity/test.default.json | 0 .../2-admin-approval-required.json | 0 .../admin-approval-required.json | 0 .../checkPrincipalRole/admin-permit-all.json | 0 .../members-2-transfer-per-day.json | 0 ...-groupMember-can-transfer-1-eth-fixed.json | 0 ...roupMember-can-transfer-1-eth-rolling.json | 0 .../policy/set/address-book-and-roles.json | 0 .../set/approvals-and-spending-limit.json | 0 .../resource/policy/set/defi-interaction.json | 0 .../policy/set/tiered-eth-transfer.json | 0 .../src}/util/setup.ts | 0 packages/user-journey/tsconfig.json | 19 ++++++++++ packages/user-journey/tsconfig.lib.json | 10 +++++ tsconfig.base.json | 3 +- 31 files changed, 160 insertions(+), 14 deletions(-) create mode 100644 packages/user-journey/.eslintrc.json create mode 100644 packages/user-journey/Makefile create mode 100644 packages/user-journey/README.md create mode 100644 packages/user-journey/jest.config.ts create mode 100644 packages/user-journey/jest.e2e.ts create mode 100644 packages/user-journey/package.json create mode 100644 packages/user-journey/project.json rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/criterion/check-approvals.spec.ts (100%) rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/criterion/check-rate-limit.spec.ts (92%) rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/criterion/check-spending-limit.spec.ts (100%) rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/scenarii/address-book-management.spec.ts (97%) rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts (97%) rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/scenarii/defi-interactions.spec.ts (97%) rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts (100%) rename packages/{armory-sdk/src/lib => user-journey/src}/__test__/e2e/scenarii/user-journeys.spec.ts (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/entity/defi-interaction.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/entity/test.default.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/checkApprovals/2-admin-approval-required.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/checkApprovals/admin-approval-required.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/checkPrincipalRole/admin-permit-all.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/checkRateLimit/members-2-transfer-per-day.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/set/address-book-and-roles.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/set/approvals-and-spending-limit.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/set/defi-interaction.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/resource/policy/set/tiered-eth-transfer.json (100%) rename packages/{armory-sdk/src/lib/__test__ => user-journey/src}/util/setup.ts (100%) create mode 100644 packages/user-journey/tsconfig.json create mode 100644 packages/user-journey/tsconfig.lib.json diff --git a/packages/user-journey/.eslintrc.json b/packages/user-journey/.eslintrc.json new file mode 100644 index 000000000..9d9c0db55 --- /dev/null +++ b/packages/user-journey/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/packages/user-journey/Makefile b/packages/user-journey/Makefile new file mode 100644 index 000000000..3b482abb2 --- /dev/null +++ b/packages/user-journey/Makefile @@ -0,0 +1,37 @@ +USER_JOURNEY_PROJECT_NAME := user-journey +USER_JOURNEY_PROJECT_DIR := ./packages/user-journey + +# === Build === + +user-journey/build: + npx nx build ${USER_JOURNEY_PROJECT_NAME} + +# === Code format === + +user-journey/format: + npx nx format:write --projects ${USER_JOURNEY_PROJECT_NAME} + +user-journey/lint: + npx nx lint ${USER_JOURNEY_PROJECT_NAME} -- --fix + +user-journey/format/check: + npx nx format:check --projects ${USER_JOURNEY_PROJECT_NAME} + +user-journey/lint/check: + npx nx lint ${USER_JOURNEY_PROJECT_NAME} + +# === Testing === + +user-journey/test/type: + npx tsc \ + --project ${USER_JOURNEY_PROJECT_DIR}/tsconfig.lib.json \ + --noEmit + +user-journey/test/unit/watch: + make user-journey/test/unit ARGS=--watch + +user-journey/test/e2e: + npx nx test:e2e ${USER_JOURNEY_PROJECT_NAME} -- ${ARGS} + +user-journey/test/e2e/watch: + make user-journey/test/e2e ARGS=--watch diff --git a/packages/user-journey/README.md b/packages/user-journey/README.md new file mode 100644 index 000000000..de62e1148 --- /dev/null +++ b/packages/user-journey/README.md @@ -0,0 +1,3 @@ +# User-journey + +This package is an e2e test package. It encapsulate some core usage scenarios for armory stack. In order to run, all diff --git a/packages/user-journey/jest.config.ts b/packages/user-journey/jest.config.ts new file mode 100644 index 000000000..8015e7979 --- /dev/null +++ b/packages/user-journey/jest.config.ts @@ -0,0 +1,18 @@ +import type { Config } from 'jest' + +const config: Config = { + displayName: 'armory-sdk', + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + preset: '../../jest.preset.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': [ + 'ts-jest', + { + tsconfig: '/tsconfig.spec.json' + } + ] + } +} + +export default config diff --git a/packages/user-journey/jest.e2e.ts b/packages/user-journey/jest.e2e.ts new file mode 100644 index 000000000..b7d56d62b --- /dev/null +++ b/packages/user-journey/jest.e2e.ts @@ -0,0 +1,9 @@ +import type { Config } from 'jest' +import sharedConfig from './jest.config' + +const config: Config = { + ...sharedConfig, + testMatch: ['/**/__test__/e2e/**/*.spec.ts'] +} + +export default config diff --git a/packages/user-journey/package.json b/packages/user-journey/package.json new file mode 100644 index 000000000..a562a5922 --- /dev/null +++ b/packages/user-journey/package.json @@ -0,0 +1,10 @@ +{ + "name": "user-journey", + "version": "0.0.1", + "description": "it's a test suite that covers core scenario for narval's armory.", + "dependencies": { + "@narval-xyz/armory-sdk": "0.8.3" + }, + "author": "", + "license": "ISC" +} diff --git a/packages/user-journey/project.json b/packages/user-journey/project.json new file mode 100644 index 000000000..64f4f6220 --- /dev/null +++ b/packages/user-journey/project.json @@ -0,0 +1,21 @@ +{ + "name": "user-journey", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/user-journey/src", + "projectType": "library", + "tags": [], + "targets": { + "lint": { + "executor": "@nx/eslint:lint" + }, + "test:e2e": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "packages/armory-sdk/jest.e2e.ts", + "verbose": true, + "runInBand": true + } + } + } +} diff --git a/packages/armory-sdk/src/lib/__test__/e2e/criterion/check-approvals.spec.ts b/packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts similarity index 100% rename from packages/armory-sdk/src/lib/__test__/e2e/criterion/check-approvals.spec.ts rename to packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts diff --git a/packages/armory-sdk/src/lib/__test__/e2e/criterion/check-rate-limit.spec.ts b/packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts similarity index 92% rename from packages/armory-sdk/src/lib/__test__/e2e/criterion/check-rate-limit.spec.ts rename to packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts index 769246bb4..13e82800d 100644 --- a/packages/armory-sdk/src/lib/__test__/e2e/criterion/check-rate-limit.spec.ts +++ b/packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts @@ -1,8 +1,5 @@ import { Action, entitiesSchema, FIXTURE, Request } from '@narval/policy-engine-shared' import { v4 } from 'uuid' -import defaultEntities from '../../resource/entity/test.default.json' -import adminPermitAll from '../../resource/policy/checkPrincipalRole/admin-permit-all.json' -import memberTwoTransferPerDay from '../../resource/policy/checkRateLimit/members-2-transfer-per-day.json' import { buildAuthClient, buildPolicy, @@ -12,6 +9,9 @@ import { getAuthHost, saveDataStore } from '../../util/setup' +import defaultEntities from '../resource/entity/test.default.json' +import adminPermitAll from '../resource/policy/checkPrincipalRole/admin-permit-all.json' +import memberTwoTransferPerDay from '../resource/policy/checkRateLimit/members-2-transfer-per-day.json' const systemManagerHexPk = FIXTURE.UNSAFE_PRIVATE_KEY.Root const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric diff --git a/packages/armory-sdk/src/lib/__test__/e2e/criterion/check-spending-limit.spec.ts b/packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts similarity index 100% rename from packages/armory-sdk/src/lib/__test__/e2e/criterion/check-spending-limit.spec.ts rename to packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts diff --git a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/address-book-management.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts similarity index 97% rename from packages/armory-sdk/src/lib/__test__/e2e/scenarii/address-book-management.spec.ts rename to packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts index 07884f0ce..a5878739d 100644 --- a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/address-book-management.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts @@ -11,9 +11,9 @@ import { AddressBookAddresses } from 'packages/policy-engine-shared/src/lib/dev. import { v4 } from 'uuid' import { Hex } from 'viem' import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts' -import defaultEntities from '../../resource/entity/test.default.json' -import addressBookAndRoles from '../../resource/policy/set/address-book-and-roles.json' -import { buildAuthClient, createClient, saveDataStore } from '../../util/setup' +import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup' +import defaultEntities from '../resource/entity/test.default.json' +import addressBookAndRoles from '../resource/policy/set/address-book-and-roles.json' const TEST_TIMEOUT_MS = 30_000 diff --git a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts similarity index 97% rename from packages/armory-sdk/src/lib/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts rename to packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts index fd8a43e7a..729b79a61 100644 --- a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts @@ -1,5 +1,5 @@ /* eslint-disable jest/consistent-test-it */ -import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request } from '@narval/policy-engine-shared' +import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request } from '@narval-xyz/armory-sdk' import { v4 } from 'uuid' import defaultEntities from '../../resource/entity/test.default.json' import approvalsAndSpendingLimit from '../../resource/policy/set/approvals-and-spending-limit.json' @@ -9,7 +9,7 @@ const TEST_TIMEOUT_MS = 30_000 jest.setTimeout(TEST_TIMEOUT_MS) -export const advanceTime = (hours: number): void => { +export const peradvanceTime = (hours: number): void => { jest.useFakeTimers() jest.setSystemTime(Date.now() + hours * 60 * 60 * 1000) } @@ -25,7 +25,7 @@ const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric const genNonce = (request: Request) => ({ ...request, nonce: `${request.nonce}-${v4()}` }) describe('approvals and spending limits', () => { - describe('members can spend up to 1 eth per day, above an approval is required', () => { + describe('members can spend up to 1 eth day, above an approval is required', () => { const request: Request = { action: Action.SIGN_TRANSACTION, nonce: 'test-nonce-4', diff --git a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/defi-interactions.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts similarity index 97% rename from packages/armory-sdk/src/lib/__test__/e2e/scenarii/defi-interactions.spec.ts rename to packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts index 285d289b0..6f34d9d7e 100644 --- a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/defi-interactions.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts @@ -6,11 +6,11 @@ import { FIXTURE, policySchema, Request -} from '@narval/policy-engine-shared' +} from '@narval-xyz/armory-sdk' import { v4 } from 'uuid' -import defiEntities from '../../resource/entity/defi-interaction.json' -import defiInteractionPolicy from '../../resource/policy/set/defi-interaction.json' -import { buildAuthClient, createClient, saveDataStore } from '../../util/setup' +import defiEntities from '../../../resource/entity/defi-interaction.json' +import defiInteractionPolicy from '../../../resource/policy/set/defi-interaction.json' +import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup' const TEST_TIMEOUT_MS = 30_000 diff --git a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts similarity index 100% rename from packages/armory-sdk/src/lib/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts rename to packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts diff --git a/packages/armory-sdk/src/lib/__test__/e2e/scenarii/user-journeys.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts similarity index 100% rename from packages/armory-sdk/src/lib/__test__/e2e/scenarii/user-journeys.spec.ts rename to packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts diff --git a/packages/armory-sdk/src/lib/__test__/resource/entity/defi-interaction.json b/packages/user-journey/src/resource/entity/defi-interaction.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/entity/defi-interaction.json rename to packages/user-journey/src/resource/entity/defi-interaction.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/entity/test.default.json b/packages/user-journey/src/resource/entity/test.default.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/entity/test.default.json rename to packages/user-journey/src/resource/entity/test.default.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/checkApprovals/2-admin-approval-required.json b/packages/user-journey/src/resource/policy/checkApprovals/2-admin-approval-required.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/checkApprovals/2-admin-approval-required.json rename to packages/user-journey/src/resource/policy/checkApprovals/2-admin-approval-required.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/checkApprovals/admin-approval-required.json b/packages/user-journey/src/resource/policy/checkApprovals/admin-approval-required.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/checkApprovals/admin-approval-required.json rename to packages/user-journey/src/resource/policy/checkApprovals/admin-approval-required.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/checkPrincipalRole/admin-permit-all.json b/packages/user-journey/src/resource/policy/checkPrincipalRole/admin-permit-all.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/checkPrincipalRole/admin-permit-all.json rename to packages/user-journey/src/resource/policy/checkPrincipalRole/admin-permit-all.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/checkRateLimit/members-2-transfer-per-day.json b/packages/user-journey/src/resource/policy/checkRateLimit/members-2-transfer-per-day.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/checkRateLimit/members-2-transfer-per-day.json rename to packages/user-journey/src/resource/policy/checkRateLimit/members-2-transfer-per-day.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json b/packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json rename to packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json b/packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json rename to packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/set/address-book-and-roles.json b/packages/user-journey/src/resource/policy/set/address-book-and-roles.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/set/address-book-and-roles.json rename to packages/user-journey/src/resource/policy/set/address-book-and-roles.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/set/approvals-and-spending-limit.json b/packages/user-journey/src/resource/policy/set/approvals-and-spending-limit.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/set/approvals-and-spending-limit.json rename to packages/user-journey/src/resource/policy/set/approvals-and-spending-limit.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/set/defi-interaction.json b/packages/user-journey/src/resource/policy/set/defi-interaction.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/set/defi-interaction.json rename to packages/user-journey/src/resource/policy/set/defi-interaction.json diff --git a/packages/armory-sdk/src/lib/__test__/resource/policy/set/tiered-eth-transfer.json b/packages/user-journey/src/resource/policy/set/tiered-eth-transfer.json similarity index 100% rename from packages/armory-sdk/src/lib/__test__/resource/policy/set/tiered-eth-transfer.json rename to packages/user-journey/src/resource/policy/set/tiered-eth-transfer.json diff --git a/packages/armory-sdk/src/lib/__test__/util/setup.ts b/packages/user-journey/src/util/setup.ts similarity index 100% rename from packages/armory-sdk/src/lib/__test__/util/setup.ts rename to packages/user-journey/src/util/setup.ts diff --git a/packages/user-journey/tsconfig.json b/packages/user-journey/tsconfig.json new file mode 100644 index 000000000..db7b56666 --- /dev/null +++ b/packages/user-journey/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/packages/user-journey/tsconfig.lib.json b/packages/user-journey/tsconfig.lib.json new file mode 100644 index 000000000..faa09cc18 --- /dev/null +++ b/packages/user-journey/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 92bb58da7..a8a7193be 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -20,7 +20,8 @@ "@narval/nestjs-shared": ["packages/nestjs-shared/src/index.ts"], "@narval/policy-engine-shared": ["packages/policy-engine-shared/src/index.ts"], "@narval/signature": ["packages/signature/src/index.ts"], - "@narval/transaction-request-intent": ["packages/transaction-request-intent/src/index.ts"] + "@narval/transaction-request-intent": ["packages/transaction-request-intent/src/index.ts"], + "@narval/user-journey": ["packages/user-journey/src/index.ts"] }, "removeComments": true, "rootDir": ".", From 3f83e87bddb5f017d067282e277a37bf454e0457 Mon Sep 17 00:00:00 2001 From: Pierre Troger Date: Fri, 11 Oct 2024 11:58:36 +0200 Subject: [PATCH 2/7] import sdk from path, added API clients to sdk exports --- Makefile | 1 + packages/armory-sdk/src/index.ts | 3 ++ packages/user-journey/.eslintrc.json | 7 +++++ packages/user-journey/package.json | 10 ------- packages/user-journey/project.json | 8 +++-- .../e2e/criterion/check-approvals.spec.ts | 10 +++---- .../e2e/criterion/check-rate-limit.spec.ts | 8 ++--- .../criterion/check-spending-limit.spec.ts | 10 +++---- .../scenarii/address-book-management.spec.ts | 4 +-- .../approvals-and-spending-limit.spec.ts | 8 ++--- .../e2e/scenarii/defi-interactions.spec.ts | 2 +- .../tiered-eth-transfer-policy.spec.ts | 6 ++-- .../e2e/scenarii/user-journeys.spec.ts | 29 ++++++++++++------- packages/user-journey/src/util/setup.ts | 14 +++++++-- packages/user-journey/tsconfig.json | 19 ++++++------ packages/user-journey/tsconfig.lib.json | 2 +- packages/user-journey/tsconfig.spec.json | 9 ++++++ tsconfig.base.json | 3 +- 18 files changed, 91 insertions(+), 62 deletions(-) delete mode 100644 packages/user-journey/package.json create mode 100644 packages/user-journey/tsconfig.spec.json diff --git a/Makefile b/Makefile index 75a1b429d..c1ca34140 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ include ./packages/policy-engine-shared/Makefile include ./packages/transaction-request-intent/Makefile include ./packages/signature/Makefile include ./packages/armory-sdk/Makefile +include ./packages/user-journey/Makefile # For more terminal color codes, head over to # https://opensource.com/article/19/9/linux-terminal-colors diff --git a/packages/armory-sdk/src/index.ts b/packages/armory-sdk/src/index.ts index 694101d6d..d836db6bb 100644 --- a/packages/armory-sdk/src/index.ts +++ b/packages/armory-sdk/src/index.ts @@ -7,6 +7,9 @@ export * from './lib/shared/promise' export * from './lib/types' export * from './lib/vault' +export { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from './lib/http/client/auth' +export { ClientDto, WalletDto } from './lib/http/client/vault' +export { Signer } from './lib/shared/type' export { resourceId } from './lib/utils' export type { Jwk, PrivateKey, PublicKey, RsaPublicKey } from '@narval/signature' diff --git a/packages/user-journey/.eslintrc.json b/packages/user-journey/.eslintrc.json index 9d9c0db55..adbe7ae2d 100644 --- a/packages/user-journey/.eslintrc.json +++ b/packages/user-journey/.eslintrc.json @@ -13,6 +13,13 @@ { "files": ["*.js", "*.jsx"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": "error" + } } ] } diff --git a/packages/user-journey/package.json b/packages/user-journey/package.json deleted file mode 100644 index a562a5922..000000000 --- a/packages/user-journey/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "user-journey", - "version": "0.0.1", - "description": "it's a test suite that covers core scenario for narval's armory.", - "dependencies": { - "@narval-xyz/armory-sdk": "0.8.3" - }, - "author": "", - "license": "ISC" -} diff --git a/packages/user-journey/project.json b/packages/user-journey/project.json index 64f4f6220..a177c61d3 100644 --- a/packages/user-journey/project.json +++ b/packages/user-journey/project.json @@ -6,13 +6,17 @@ "tags": [], "targets": { "lint": { - "executor": "@nx/eslint:lint" + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/user-journey/**/*.ts"] + } }, "test:e2e": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "packages/armory-sdk/jest.e2e.ts", + "jestConfig": "packages/user-journey/jest.e2e.ts", "verbose": true, "runInBand": true } diff --git a/packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts b/packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts index c54e8435f..849803d46 100644 --- a/packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts +++ b/packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts @@ -1,9 +1,9 @@ import { Action, Decision, entitiesSchema, FIXTURE, Request } from '@narval/policy-engine-shared' import { v4 } from 'uuid' -import defaultEntities from '../../resource/entity/test.default.json' -import twoAdminApproval from '../../resource/policy/checkApprovals/2-admin-approval-required.json' -import adminApproval from '../../resource/policy/checkApprovals/admin-approval-required.json' -import adminPermitAll from '../../resource/policy/checkPrincipalRole/admin-permit-all.json' +import defaultEntities from '../../../resource/entity/test.default.json' +import twoAdminApproval from '../../../resource/policy/checkApprovals/2-admin-approval-required.json' +import adminApproval from '../../../resource/policy/checkApprovals/admin-approval-required.json' +import adminPermitAll from '../../../resource/policy/checkPrincipalRole/admin-permit-all.json' import { buildAuthClient, buildPolicy, @@ -12,7 +12,7 @@ import { getAuthAdminApiKey, getAuthHost, saveDataStore -} from '../../util/setup' +} from '../../../util/setup' const systemManagerHexPk = FIXTURE.UNSAFE_PRIVATE_KEY.Root const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric diff --git a/packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts b/packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts index 13e82800d..344dd3589 100644 --- a/packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts +++ b/packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts @@ -1,5 +1,8 @@ import { Action, entitiesSchema, FIXTURE, Request } from '@narval/policy-engine-shared' import { v4 } from 'uuid' +import defaultEntities from '../../../resource/entity/test.default.json' +import adminPermitAll from '../../../resource/policy/checkPrincipalRole/admin-permit-all.json' +import memberTwoTransferPerDay from '../../../resource/policy/checkRateLimit/members-2-transfer-per-day.json' import { buildAuthClient, buildPolicy, @@ -8,10 +11,7 @@ import { getAuthAdminApiKey, getAuthHost, saveDataStore -} from '../../util/setup' -import defaultEntities from '../resource/entity/test.default.json' -import adminPermitAll from '../resource/policy/checkPrincipalRole/admin-permit-all.json' -import memberTwoTransferPerDay from '../resource/policy/checkRateLimit/members-2-transfer-per-day.json' +} from '../../../util/setup' const systemManagerHexPk = FIXTURE.UNSAFE_PRIVATE_KEY.Root const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric diff --git a/packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts b/packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts index c5d2c29a9..bebcf5fbf 100644 --- a/packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts +++ b/packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts @@ -1,9 +1,9 @@ import { Action, entitiesSchema, FIXTURE, Request } from '@narval/policy-engine-shared' import { v4 } from 'uuid' -import defaultEntities from '../../resource/entity/test.default.json' -import adminPermitAll from '../../resource/policy/checkPrincipalRole/admin-permit-all.json' -import treasuryMemberCanTransferOneEthFixed from '../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json' -import treasuryMemberCanTransferOneEthRolling from '../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json' +import defaultEntities from '../../../resource/entity/test.default.json' +import adminPermitAll from '../../../resource/policy/checkPrincipalRole/admin-permit-all.json' +import treasuryMemberCanTransferOneEthFixed from '../../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json' +import treasuryMemberCanTransferOneEthRolling from '../../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json' import { buildAuthClient, buildPolicy, @@ -12,7 +12,7 @@ import { getAuthAdminApiKey, getAuthHost, saveDataStore -} from '../../util/setup' +} from '../../../util/setup' const systemManagerHexPk = FIXTURE.UNSAFE_PRIVATE_KEY.Root const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric diff --git a/packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts index a5878739d..29f469812 100644 --- a/packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts @@ -11,9 +11,9 @@ import { AddressBookAddresses } from 'packages/policy-engine-shared/src/lib/dev. import { v4 } from 'uuid' import { Hex } from 'viem' import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts' +import defaultEntities from '../../../resource/entity/test.default.json' +import addressBookAndRoles from '../../../resource/policy/set/address-book-and-roles.json' import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup' -import defaultEntities from '../resource/entity/test.default.json' -import addressBookAndRoles from '../resource/policy/set/address-book-and-roles.json' const TEST_TIMEOUT_MS = 30_000 diff --git a/packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts index 729b79a61..a861d3353 100644 --- a/packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts @@ -1,9 +1,9 @@ /* eslint-disable jest/consistent-test-it */ -import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request } from '@narval-xyz/armory-sdk' +import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request } from '@narval/policy-engine-shared' import { v4 } from 'uuid' -import defaultEntities from '../../resource/entity/test.default.json' -import approvalsAndSpendingLimit from '../../resource/policy/set/approvals-and-spending-limit.json' -import { buildAuthClient, createClient, saveDataStore } from '../../util/setup' +import defaultEntities from '../../../resource/entity/test.default.json' +import approvalsAndSpendingLimit from '../../../resource/policy/set/approvals-and-spending-limit.json' +import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup' const TEST_TIMEOUT_MS = 30_000 diff --git a/packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts index 6f34d9d7e..a0171e9fc 100644 --- a/packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts @@ -6,7 +6,7 @@ import { FIXTURE, policySchema, Request -} from '@narval-xyz/armory-sdk' +} from '@narval/policy-engine-shared' import { v4 } from 'uuid' import defiEntities from '../../../resource/entity/defi-interaction.json' import defiInteractionPolicy from '../../../resource/policy/set/defi-interaction.json' diff --git a/packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts index d162947e3..ee43952e1 100644 --- a/packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts @@ -1,9 +1,9 @@ /* eslint-disable jest/consistent-test-it */ import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request, toHex } from '@narval/policy-engine-shared' import { v4 } from 'uuid' -import defaultEntities from '../../resource/entity/test.default.json' -import tieredEthTransfer from '../../resource/policy/set/tiered-eth-transfer.json' -import { buildAuthClient, createClient, saveDataStore } from '../../util/setup' +import defaultEntities from '../../../resource/entity/test.default.json' +import tieredEthTransfer from '../../../resource/policy/set/tiered-eth-transfer.json' +import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup' const TEST_TIMEOUT_MS = 30_000 diff --git a/packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts b/packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts index 7737bd162..66bf3bdcd 100644 --- a/packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts +++ b/packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts @@ -1,4 +1,23 @@ /* eslint-disable jest/consistent-test-it */ +import { + AuthAdminClient, + AuthClient, + AuthorizationResponseDtoStatusEnum, + ClientDto, + CreateClientResponseDto, + DataStoreConfig, + EntityStoreClient, + Permission, + PolicyStoreClient, + SignOptions, + Signer, + VaultAdminClient, + VaultClient, + WalletDto, + createHttpDataStore, + credential, + resourceId +} from '@narval/armory-sdk' import { AccessToken, AccountEntity, @@ -26,16 +45,6 @@ import { import { format } from 'date-fns' import { v4 as uuid } from 'uuid' import { english, generateMnemonic, generatePrivateKey, privateKeyToAccount } from 'viem/accounts' -import { AuthAdminClient, AuthClient } from '../../../auth/client' -import { EntityStoreClient, PolicyStoreClient } from '../../../data-store/client' -import { DataStoreConfig } from '../../../data-store/type' -import { createHttpDataStore, credential } from '../../../data-store/util' -import { Permission } from '../../../domain' -import { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from '../../../http/client/auth' -import { ClientDto, WalletDto } from '../../../http/client/vault' -import { SignOptions, Signer } from '../../../shared/type' -import { resourceId } from '../../../utils' -import { VaultAdminClient, VaultClient } from '../../../vault/client' const TEST_TIMEOUT_MS = 30_000 diff --git a/packages/user-journey/src/util/setup.ts b/packages/user-journey/src/util/setup.ts index 6ad031b06..ea606d58a 100644 --- a/packages/user-journey/src/util/setup.ts +++ b/packages/user-journey/src/util/setup.ts @@ -1,10 +1,18 @@ +import { + AuthAdminClient, + AuthClient, + AuthConfig, + createHttpDataStore, + DataStoreConfig, + EntityStoreClient, + PolicyStoreClient, + VaultAdminClient, + VaultConfig +} from '@narval/armory-sdk' import { Entities, Hex, Policy, policySchema, Request } from '@narval/policy-engine-shared' import { buildSignerForAlg, getPublicKey, privateKeyToJwk } from '@narval/signature' import { format } from 'date-fns' import { v4 } from 'uuid' -import { AuthAdminClient, AuthClient, AuthConfig } from '../../auth' -import { createHttpDataStore, DataStoreConfig, EntityStoreClient, PolicyStoreClient } from '../../data-store' -import { VaultAdminClient, VaultConfig } from '../../vault' export const getAuthHost = () => 'http://localhost:3005' export const getAuthAdminApiKey = () => 'armory-admin-api-key' diff --git a/packages/user-journey/tsconfig.json b/packages/user-journey/tsconfig.json index db7b56666..efb889526 100644 --- a/packages/user-journey/tsconfig.json +++ b/packages/user-journey/tsconfig.json @@ -1,19 +1,18 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "module": "commonjs", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, "files": [], "include": [], "references": [ { "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" } - ] + ], + "compilerOptions": { + "module": "commonjs", + "strict": true, + "resolveJsonModule": true + } } diff --git a/packages/user-journey/tsconfig.lib.json b/packages/user-journey/tsconfig.lib.json index faa09cc18..2e16b8791 100644 --- a/packages/user-journey/tsconfig.lib.json +++ b/packages/user-journey/tsconfig.lib.json @@ -6,5 +6,5 @@ "types": ["node"] }, "include": ["src/**/*.ts"], - "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] + "exclude": ["jest.config.ts", "src/**/*.spec.ts"] } diff --git a/packages/user-journey/tsconfig.spec.json b/packages/user-journey/tsconfig.spec.json new file mode 100644 index 000000000..f6d8ffcc9 --- /dev/null +++ b/packages/user-journey/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index a8a7193be..92bb58da7 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -20,8 +20,7 @@ "@narval/nestjs-shared": ["packages/nestjs-shared/src/index.ts"], "@narval/policy-engine-shared": ["packages/policy-engine-shared/src/index.ts"], "@narval/signature": ["packages/signature/src/index.ts"], - "@narval/transaction-request-intent": ["packages/transaction-request-intent/src/index.ts"], - "@narval/user-journey": ["packages/user-journey/src/index.ts"] + "@narval/transaction-request-intent": ["packages/transaction-request-intent/src/index.ts"] }, "removeComments": true, "rootDir": ".", From 33d7865fb9a66a5a881df7c6d9053f6aea62167c Mon Sep 17 00:00:00 2001 From: Pierre Troger Date: Fri, 11 Oct 2024 12:06:05 +0200 Subject: [PATCH 3/7] remove user-journey from package CI --- .github/workflows/packages.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 2daa9cdc7..d6a7f525c 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -54,25 +54,25 @@ jobs: - name: Code format run: | npx nx affected --target format:check lint:check \ - --exclude tag:type:application \ + --exclude tag:type:application,user-journey \ --base=origin/main - name: Test types run: | npx nx affected --target test:type \ - --exclude tag:type:application \ + --exclude tag:type:application,user-journey \ --base=origin/main - name: Test unit run: | npx nx affected --target test:unit \ - --exclude tag:type:application \ + --exclude tag:type:application,user-journey \ --base=origin/main - name: Test integration run: | npx nx affected --target test:integration \ - --exclude tag:type:application \ + --exclude tag:type:application,user-journey \ --base=origin/main - name: Test end-to-end @@ -83,7 +83,7 @@ jobs: # in-memory. It'd be a good time to revisit this TODO and think about # using testcontainers. npx nx affected --target test:e2e \ - --exclude tag:type:application \ + --exclude tag:type:application,user-journey \ --base=origin/main \ --testPathIgnorePatterns=packages/armory-sdk/src/lib/__test__/e2e/* From f4d9811edd22fb0dcc1440a7afbc43cac8511d15 Mon Sep 17 00:00:00 2001 From: Pierre Troger Date: Fri, 11 Oct 2024 12:09:43 +0200 Subject: [PATCH 4/7] specify type export in armory-sdk --- packages/armory-sdk/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/armory-sdk/src/index.ts b/packages/armory-sdk/src/index.ts index d836db6bb..0d4ce68c9 100644 --- a/packages/armory-sdk/src/index.ts +++ b/packages/armory-sdk/src/index.ts @@ -7,10 +7,10 @@ export * from './lib/shared/promise' export * from './lib/types' export * from './lib/vault' -export { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from './lib/http/client/auth' -export { ClientDto, WalletDto } from './lib/http/client/vault' -export { Signer } from './lib/shared/type' -export { resourceId } from './lib/utils' +export type { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from './lib/http/client/auth' +export type { ClientDto, WalletDto } from './lib/http/client/vault' +export type { Signer } from './lib/shared/type' +export type { resourceId } from './lib/utils' export type { Jwk, PrivateKey, PublicKey, RsaPublicKey } from '@narval/signature' From 04481c46c3bf609224eb2f252ceed013e45e9b68 Mon Sep 17 00:00:00 2001 From: Pierre Troger Date: Fri, 11 Oct 2024 12:13:28 +0200 Subject: [PATCH 5/7] removed type from resourceId function --- packages/armory-sdk/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/armory-sdk/src/index.ts b/packages/armory-sdk/src/index.ts index 0d4ce68c9..1da49822f 100644 --- a/packages/armory-sdk/src/index.ts +++ b/packages/armory-sdk/src/index.ts @@ -10,7 +10,7 @@ export * from './lib/vault' export type { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from './lib/http/client/auth' export type { ClientDto, WalletDto } from './lib/http/client/vault' export type { Signer } from './lib/shared/type' -export type { resourceId } from './lib/utils' +export { resourceId } from './lib/utils' export type { Jwk, PrivateKey, PublicKey, RsaPublicKey } from '@narval/signature' From 2486c55597e9f9d22baf1113149d366e516165d7 Mon Sep 17 00:00:00 2001 From: Pierre Troger Date: Wed, 23 Oct 2024 11:53:19 +0200 Subject: [PATCH 6/7] renamed user-journey package --- .../{user-journey => armory-e2e-testing}/.eslintrc.json | 0 packages/{user-journey => armory-e2e-testing}/Makefile | 0 packages/{user-journey => armory-e2e-testing}/README.md | 0 .../{user-journey => armory-e2e-testing}/jest.config.ts | 0 packages/{user-journey => armory-e2e-testing}/jest.e2e.ts | 0 .../{user-journey => armory-e2e-testing}/project.json | 8 ++++---- .../src/__test__/e2e/criterion/check-approvals.spec.ts | 0 .../src/__test__/e2e/criterion/check-rate-limit.spec.ts | 0 .../__test__/e2e/criterion/check-spending-limit.spec.ts | 0 .../__test__/e2e/scenarii/address-book-management.spec.ts | 0 .../e2e/scenarii/approvals-and-spending-limit.spec.ts | 0 .../src/__test__/e2e/scenarii/defi-interactions.spec.ts | 0 .../e2e/scenarii/tiered-eth-transfer-policy.spec.ts | 0 .../src/__test__/e2e/scenarii/user-journeys.spec.ts | 0 .../src/resource/entity/defi-interaction.json | 0 .../src/resource/entity/test.default.json | 0 .../policy/checkApprovals/2-admin-approval-required.json | 0 .../policy/checkApprovals/admin-approval-required.json | 0 .../policy/checkPrincipalRole/admin-permit-all.json | 0 .../policy/checkRateLimit/members-2-transfer-per-day.json | 0 .../treasury-groupMember-can-transfer-1-eth-fixed.json | 0 .../treasury-groupMember-can-transfer-1-eth-rolling.json | 0 .../src/resource/policy/set/address-book-and-roles.json | 0 .../resource/policy/set/approvals-and-spending-limit.json | 0 .../src/resource/policy/set/defi-interaction.json | 0 .../src/resource/policy/set/tiered-eth-transfer.json | 0 .../src/util/setup.ts | 0 .../{user-journey => armory-e2e-testing}/tsconfig.json | 0 .../tsconfig.lib.json | 0 .../tsconfig.spec.json | 0 30 files changed, 4 insertions(+), 4 deletions(-) rename packages/{user-journey => armory-e2e-testing}/.eslintrc.json (100%) rename packages/{user-journey => armory-e2e-testing}/Makefile (100%) rename packages/{user-journey => armory-e2e-testing}/README.md (100%) rename packages/{user-journey => armory-e2e-testing}/jest.config.ts (100%) rename packages/{user-journey => armory-e2e-testing}/jest.e2e.ts (100%) rename packages/{user-journey => armory-e2e-testing}/project.json (67%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/criterion/check-approvals.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/criterion/check-rate-limit.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/criterion/check-spending-limit.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/scenarii/address-book-management.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/scenarii/defi-interactions.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/__test__/e2e/scenarii/user-journeys.spec.ts (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/entity/defi-interaction.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/entity/test.default.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/checkApprovals/2-admin-approval-required.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/checkApprovals/admin-approval-required.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/checkPrincipalRole/admin-permit-all.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/checkRateLimit/members-2-transfer-per-day.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/set/address-book-and-roles.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/set/approvals-and-spending-limit.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/set/defi-interaction.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/resource/policy/set/tiered-eth-transfer.json (100%) rename packages/{user-journey => armory-e2e-testing}/src/util/setup.ts (100%) rename packages/{user-journey => armory-e2e-testing}/tsconfig.json (100%) rename packages/{user-journey => armory-e2e-testing}/tsconfig.lib.json (100%) rename packages/{user-journey => armory-e2e-testing}/tsconfig.spec.json (100%) diff --git a/packages/user-journey/.eslintrc.json b/packages/armory-e2e-testing/.eslintrc.json similarity index 100% rename from packages/user-journey/.eslintrc.json rename to packages/armory-e2e-testing/.eslintrc.json diff --git a/packages/user-journey/Makefile b/packages/armory-e2e-testing/Makefile similarity index 100% rename from packages/user-journey/Makefile rename to packages/armory-e2e-testing/Makefile diff --git a/packages/user-journey/README.md b/packages/armory-e2e-testing/README.md similarity index 100% rename from packages/user-journey/README.md rename to packages/armory-e2e-testing/README.md diff --git a/packages/user-journey/jest.config.ts b/packages/armory-e2e-testing/jest.config.ts similarity index 100% rename from packages/user-journey/jest.config.ts rename to packages/armory-e2e-testing/jest.config.ts diff --git a/packages/user-journey/jest.e2e.ts b/packages/armory-e2e-testing/jest.e2e.ts similarity index 100% rename from packages/user-journey/jest.e2e.ts rename to packages/armory-e2e-testing/jest.e2e.ts diff --git a/packages/user-journey/project.json b/packages/armory-e2e-testing/project.json similarity index 67% rename from packages/user-journey/project.json rename to packages/armory-e2e-testing/project.json index a177c61d3..2f020b349 100644 --- a/packages/user-journey/project.json +++ b/packages/armory-e2e-testing/project.json @@ -1,7 +1,7 @@ { - "name": "user-journey", + "name": "armory-e2e-testing", "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/user-journey/src", + "sourceRoot": "packages/armory-e2e-testing/src", "projectType": "library", "tags": [], "targets": { @@ -9,14 +9,14 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/user-journey/**/*.ts"] + "lintFilePatterns": ["packages/armory-e2e-testing/**/*.ts"] } }, "test:e2e": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "packages/user-journey/jest.e2e.ts", + "jestConfig": "packages/armory-e2e-testing/jest.e2e.ts", "verbose": true, "runInBand": true } diff --git a/packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/criterion/check-approvals.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/criterion/check-approvals.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/criterion/check-approvals.spec.ts diff --git a/packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/criterion/check-rate-limit.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/criterion/check-rate-limit.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/criterion/check-rate-limit.spec.ts diff --git a/packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/criterion/check-spending-limit.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/criterion/check-spending-limit.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/criterion/check-spending-limit.spec.ts diff --git a/packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/scenarii/address-book-management.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/scenarii/address-book-management.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/scenarii/address-book-management.spec.ts diff --git a/packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/scenarii/approvals-and-spending-limit.spec.ts diff --git a/packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/scenarii/defi-interactions.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/scenarii/defi-interactions.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/scenarii/defi-interactions.spec.ts diff --git a/packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/scenarii/tiered-eth-transfer-policy.spec.ts diff --git a/packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts b/packages/armory-e2e-testing/src/__test__/e2e/scenarii/user-journeys.spec.ts similarity index 100% rename from packages/user-journey/src/__test__/e2e/scenarii/user-journeys.spec.ts rename to packages/armory-e2e-testing/src/__test__/e2e/scenarii/user-journeys.spec.ts diff --git a/packages/user-journey/src/resource/entity/defi-interaction.json b/packages/armory-e2e-testing/src/resource/entity/defi-interaction.json similarity index 100% rename from packages/user-journey/src/resource/entity/defi-interaction.json rename to packages/armory-e2e-testing/src/resource/entity/defi-interaction.json diff --git a/packages/user-journey/src/resource/entity/test.default.json b/packages/armory-e2e-testing/src/resource/entity/test.default.json similarity index 100% rename from packages/user-journey/src/resource/entity/test.default.json rename to packages/armory-e2e-testing/src/resource/entity/test.default.json diff --git a/packages/user-journey/src/resource/policy/checkApprovals/2-admin-approval-required.json b/packages/armory-e2e-testing/src/resource/policy/checkApprovals/2-admin-approval-required.json similarity index 100% rename from packages/user-journey/src/resource/policy/checkApprovals/2-admin-approval-required.json rename to packages/armory-e2e-testing/src/resource/policy/checkApprovals/2-admin-approval-required.json diff --git a/packages/user-journey/src/resource/policy/checkApprovals/admin-approval-required.json b/packages/armory-e2e-testing/src/resource/policy/checkApprovals/admin-approval-required.json similarity index 100% rename from packages/user-journey/src/resource/policy/checkApprovals/admin-approval-required.json rename to packages/armory-e2e-testing/src/resource/policy/checkApprovals/admin-approval-required.json diff --git a/packages/user-journey/src/resource/policy/checkPrincipalRole/admin-permit-all.json b/packages/armory-e2e-testing/src/resource/policy/checkPrincipalRole/admin-permit-all.json similarity index 100% rename from packages/user-journey/src/resource/policy/checkPrincipalRole/admin-permit-all.json rename to packages/armory-e2e-testing/src/resource/policy/checkPrincipalRole/admin-permit-all.json diff --git a/packages/user-journey/src/resource/policy/checkRateLimit/members-2-transfer-per-day.json b/packages/armory-e2e-testing/src/resource/policy/checkRateLimit/members-2-transfer-per-day.json similarity index 100% rename from packages/user-journey/src/resource/policy/checkRateLimit/members-2-transfer-per-day.json rename to packages/armory-e2e-testing/src/resource/policy/checkRateLimit/members-2-transfer-per-day.json diff --git a/packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json b/packages/armory-e2e-testing/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json similarity index 100% rename from packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json rename to packages/armory-e2e-testing/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json diff --git a/packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json b/packages/armory-e2e-testing/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json similarity index 100% rename from packages/user-journey/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json rename to packages/armory-e2e-testing/src/resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json diff --git a/packages/user-journey/src/resource/policy/set/address-book-and-roles.json b/packages/armory-e2e-testing/src/resource/policy/set/address-book-and-roles.json similarity index 100% rename from packages/user-journey/src/resource/policy/set/address-book-and-roles.json rename to packages/armory-e2e-testing/src/resource/policy/set/address-book-and-roles.json diff --git a/packages/user-journey/src/resource/policy/set/approvals-and-spending-limit.json b/packages/armory-e2e-testing/src/resource/policy/set/approvals-and-spending-limit.json similarity index 100% rename from packages/user-journey/src/resource/policy/set/approvals-and-spending-limit.json rename to packages/armory-e2e-testing/src/resource/policy/set/approvals-and-spending-limit.json diff --git a/packages/user-journey/src/resource/policy/set/defi-interaction.json b/packages/armory-e2e-testing/src/resource/policy/set/defi-interaction.json similarity index 100% rename from packages/user-journey/src/resource/policy/set/defi-interaction.json rename to packages/armory-e2e-testing/src/resource/policy/set/defi-interaction.json diff --git a/packages/user-journey/src/resource/policy/set/tiered-eth-transfer.json b/packages/armory-e2e-testing/src/resource/policy/set/tiered-eth-transfer.json similarity index 100% rename from packages/user-journey/src/resource/policy/set/tiered-eth-transfer.json rename to packages/armory-e2e-testing/src/resource/policy/set/tiered-eth-transfer.json diff --git a/packages/user-journey/src/util/setup.ts b/packages/armory-e2e-testing/src/util/setup.ts similarity index 100% rename from packages/user-journey/src/util/setup.ts rename to packages/armory-e2e-testing/src/util/setup.ts diff --git a/packages/user-journey/tsconfig.json b/packages/armory-e2e-testing/tsconfig.json similarity index 100% rename from packages/user-journey/tsconfig.json rename to packages/armory-e2e-testing/tsconfig.json diff --git a/packages/user-journey/tsconfig.lib.json b/packages/armory-e2e-testing/tsconfig.lib.json similarity index 100% rename from packages/user-journey/tsconfig.lib.json rename to packages/armory-e2e-testing/tsconfig.lib.json diff --git a/packages/user-journey/tsconfig.spec.json b/packages/armory-e2e-testing/tsconfig.spec.json similarity index 100% rename from packages/user-journey/tsconfig.spec.json rename to packages/armory-e2e-testing/tsconfig.spec.json From ad614a4df112d40dcd8870132aa753dd6d5f3ea9 Mon Sep 17 00:00:00 2001 From: Pierre Troger Date: Wed, 23 Oct 2024 12:03:09 +0200 Subject: [PATCH 7/7] renamed manually in makefile, fixed import from sdk --- .github/workflows/packages.yml | 10 +++---- Makefile | 2 +- packages/armory-e2e-testing/Makefile | 40 ++++++++++++++-------------- packages/armory-sdk/src/index.ts | 3 ++- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index d6a7f525c..c676cbc78 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -54,25 +54,25 @@ jobs: - name: Code format run: | npx nx affected --target format:check lint:check \ - --exclude tag:type:application,user-journey \ + --exclude tag:type:application,armory-e2e-testing \ --base=origin/main - name: Test types run: | npx nx affected --target test:type \ - --exclude tag:type:application,user-journey \ + --exclude tag:type:application,armory-e2e-testing \ --base=origin/main - name: Test unit run: | npx nx affected --target test:unit \ - --exclude tag:type:application,user-journey \ + --exclude tag:type:application,armory-e2e-testing \ --base=origin/main - name: Test integration run: | npx nx affected --target test:integration \ - --exclude tag:type:application,user-journey \ + --exclude tag:type:application,armory-e2e-testing \ --base=origin/main - name: Test end-to-end @@ -83,7 +83,7 @@ jobs: # in-memory. It'd be a good time to revisit this TODO and think about # using testcontainers. npx nx affected --target test:e2e \ - --exclude tag:type:application,user-journey \ + --exclude tag:type:application,armory-e2e-testing \ --base=origin/main \ --testPathIgnorePatterns=packages/armory-sdk/src/lib/__test__/e2e/* diff --git a/Makefile b/Makefile index c1ca34140..376fe3364 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ include ./packages/policy-engine-shared/Makefile include ./packages/transaction-request-intent/Makefile include ./packages/signature/Makefile include ./packages/armory-sdk/Makefile -include ./packages/user-journey/Makefile +include ./packages/armory-e2e-testing/Makefile # For more terminal color codes, head over to # https://opensource.com/article/19/9/linux-terminal-colors diff --git a/packages/armory-e2e-testing/Makefile b/packages/armory-e2e-testing/Makefile index 3b482abb2..6b3b2ac51 100644 --- a/packages/armory-e2e-testing/Makefile +++ b/packages/armory-e2e-testing/Makefile @@ -1,37 +1,37 @@ -USER_JOURNEY_PROJECT_NAME := user-journey -USER_JOURNEY_PROJECT_DIR := ./packages/user-journey +ARMORY_E2E_TESTING_PROJECT_NAME := armory-e2e-testing +ARMORY_E2E_TESTING_PROJECT_DIR := ./packages/armory-e2e-testing # === Build === -user-journey/build: - npx nx build ${USER_JOURNEY_PROJECT_NAME} +armory-e2e-testing/build: + npx nx build ${ARMORY_E2E_TESTING_PROJECT_NAME} # === Code format === -user-journey/format: - npx nx format:write --projects ${USER_JOURNEY_PROJECT_NAME} +armory-e2e-testing/format: + npx nx format:write --projects ${ARMORY_E2E_TESTING_PROJECT_NAME} -user-journey/lint: - npx nx lint ${USER_JOURNEY_PROJECT_NAME} -- --fix +armory-e2e-testing/lint: + npx nx lint ${ARMORY_E2E_TESTING_PROJECT_NAME} -- --fix -user-journey/format/check: - npx nx format:check --projects ${USER_JOURNEY_PROJECT_NAME} +armory-e2e-testing/format/check: + npx nx format:check --projects ${ARMORY_E2E_TESTING_PROJECT_NAME} -user-journey/lint/check: - npx nx lint ${USER_JOURNEY_PROJECT_NAME} +armory-e2e-testing/lint/check: + npx nx lint ${ARMORY_E2E_TESTING_PROJECT_NAME} # === Testing === -user-journey/test/type: +armory-e2e-testing/test/type: npx tsc \ - --project ${USER_JOURNEY_PROJECT_DIR}/tsconfig.lib.json \ + --project ${ARMORY_E2E_TESTING_PROJECT_DIR}/tsconfig.lib.json \ --noEmit -user-journey/test/unit/watch: - make user-journey/test/unit ARGS=--watch +armory-e2e-testing/test/unit/watch: + make armory-e2e-testing/test/unit ARGS=--watch -user-journey/test/e2e: - npx nx test:e2e ${USER_JOURNEY_PROJECT_NAME} -- ${ARGS} +armory-e2e-testing/test/e2e: + npx nx test:e2e ${ARMORY_E2E_TESTING_PROJECT_NAME} -- ${ARGS} -user-journey/test/e2e/watch: - make user-journey/test/e2e ARGS=--watch +armory-e2e-testing/test/e2e/watch: + make armory-e2e-testing/test/e2e ARGS=--watch diff --git a/packages/armory-sdk/src/index.ts b/packages/armory-sdk/src/index.ts index 1da49822f..134104d52 100644 --- a/packages/armory-sdk/src/index.ts +++ b/packages/armory-sdk/src/index.ts @@ -7,7 +7,8 @@ export * from './lib/shared/promise' export * from './lib/types' export * from './lib/vault' -export type { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from './lib/http/client/auth' +export { AuthorizationResponseDtoStatusEnum } from './lib/http/client/auth' +export type { CreateClientResponseDto } from './lib/http/client/auth' export type { ClientDto, WalletDto } from './lib/http/client/vault' export type { Signer } from './lib/shared/type' export { resourceId } from './lib/utils'