Skip to content

Commit

Permalink
Merge pull request #77 from commercelayer/improve-tests
Browse files Browse the repository at this point in the history
Improve type definitions for `jwtDecode` and `createAssertion`
  • Loading branch information
marcomontalbano committed Apr 17, 2024
2 parents 73af7d4 + 594f88f commit 16797bb
Show file tree
Hide file tree
Showing 13 changed files with 1,360 additions and 659 deletions.
10 changes: 5 additions & 5 deletions examples/cloudflare-workers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"@commercelayer/js-auth": "workspace:*"
},
"devDependencies": {
"@cloudflare/vitest-pool-workers": "^0.1.0",
"@cloudflare/workers-types": "^4.20240314.0",
"typescript": "^5.0.4",
"vitest": "1.3.0",
"wrangler": "^3.0.0"
"@cloudflare/vitest-pool-workers": "^0.1.19",
"@cloudflare/workers-types": "^4.20240405.0",
"typescript": "^5.4.5",
"vitest": "1.5.0",
"wrangler": "^3.50.0"
}
}
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@
"build": "pnpm --filter js-auth build",
"prepare": "husky install",
"test": "pnpm --filter js-auth test",
"test:production": "pnpm --filter js-auth test -- --mode production",
"test:watch": "pnpm --filter js-auth test:watch",
"make:version": "lerna version --no-private",
"example:cjs": "pnpm --filter cjs start",
"example:esm": "pnpm --filter esm start",
"example:esm:serve": "pnpm --filter esm serve",
"version": "node update-jsr-version.js && git add ."
"version": "node update-jsr-version.js && git add .",
"dep:major": "pnpm dlx npm-check-updates --packageFile '**/package.json' -u",
"dep:minor": "pnpm dep:major -t minor"
},
"devDependencies": {
"@commercelayer/eslint-config-ts": "^1.3.0",
"@commercelayer/eslint-config-ts": "^1.4.5",
"husky": "^9.0.11",
"lerna": "^8.1.2",
"replace-in-file": "^7.1.0",
"typescript": "^5.4.2"
"typescript": "^5.4.5"
}
}
17 changes: 14 additions & 3 deletions packages/js-auth/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# Unit tests
VITE_TEST_CLIENT_ID=
# `cp .env.example .env`
# `cp .env.example .env.production`
VITE_TEST_SALES_CHANNEL_CLIENT_ID=
VITE_TEST_SALES_CHANNEL_CLIENT_SECRET=
VITE_TEST_INTEGRATION_CLIENT_ID=
VITE_TEST_INTEGRATION_CLIENT_SECRET=
VITE_TEST_AUTHORIZATION_CODE_CLIENT_ID=
VITE_TEST_AUTHORIZATION_CODE_CLIENT_SECRET=
VITE_TEST_SLUG=
VITE_TEST_USER_ID=
VITE_TEST_CUSTOMER_ID=
VITE_TEST_DOMAIN=
VITE_TEST_SCOPE=
VITE_TEST_USERNAME=
VITE_TEST_PASSWORD=
VITE_TEST_INTEGRATION_CLIENT_ID=
VITE_TEST_CLIENT_SECRET=
VITE_TEST_PROVISIONING_DOMAIN=
VITE_TEST_PROVISIONING_CLIENT_ID=
VITE_TEST_PROVISIONING_CLIENT_SECRET=
12 changes: 9 additions & 3 deletions packages/js-auth/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
declare namespace NodeJS {
interface ProcessEnv {
NODE_ENV: 'development' | 'production' | 'test'
VITE_TEST_CLIENT_ID: string
VITE_TEST_SALES_CHANNEL_CLIENT_ID: string
VITE_TEST_SALES_CHANNEL_CLIENT_SECRET: string
VITE_TEST_INTEGRATION_CLIENT_ID: string
VITE_TEST_INTEGRATION_CLIENT_SECRET: string
VITE_TEST_AUTHORIZATION_CODE_CLIENT_ID: string
VITE_TEST_AUTHORIZATION_CODE_CLIENT_SECRET: string
VITE_TEST_SLUG: string
VITE_TEST_USER_ID: string
VITE_TEST_CUSTOMER_ID: string
VITE_TEST_DOMAIN: string
VITE_TEST_SCOPE: string
VITE_TEST_USERNAME: string
VITE_TEST_PASSWORD: string
VITE_TEST_INTEGRATION_CLIENT_ID: string
VITE_TEST_CLIENT_SECRET: string
VITE_TEST_PROVISIONING_DOMAIN: string
VITE_TEST_PROVISIONING_CLIENT_ID: string
VITE_TEST_PROVISIONING_CLIENT_SECRET: string
Expand Down
11 changes: 5 additions & 6 deletions packages/js-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"scripts": {
"lint": "eslint src --ext .ts,.tsx",
"lint:fix": "eslint src --ext .ts,.tsx --fix",
"test": "pnpm run lint && vitest run --silent",
"test:watch": "vitest --silent",
"test": "pnpm run lint && vitest run",
"test:watch": "vitest",
"build": "tsup",
"jsr:publish": "pnpm dlx jsr publish"
},
Expand All @@ -46,12 +46,11 @@
"license": "MIT",
"devDependencies": {
"@types/jsonwebtoken": "^9.0.6",
"@types/node": "^20.11.27",
"@types/node": "^20.12.7",
"jsonwebtoken": "^9.0.2",
"tsup": "^8.0.2",
"typescript": "^5.4.2",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.3.1"
"typescript": "^5.4.5",
"vitest": "^1.5.0"
},
"engines": {
"node": ">=18.0.0"
Expand Down
Loading

0 comments on commit 16797bb

Please sign in to comment.