mirror of https://github.com/wg-easy/wg-easy
6 changed files with 641 additions and 29 deletions
@ -17,7 +17,8 @@ |
|||
"check:all": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm build", |
|||
"db:generate": "drizzle-kit generate", |
|||
"cli:build": "node cli/build.js", |
|||
"cli:dev": "tsx cli/index.ts" |
|||
"cli:dev": "tsx cli/index.ts", |
|||
"test:unit": "vitest run --project unit" |
|||
}, |
|||
"dependencies": { |
|||
"@eschricht/nuxt-color-mode": "^1.2.0", |
|||
@ -56,9 +57,12 @@ |
|||
}, |
|||
"devDependencies": { |
|||
"@nuxt/eslint": "^1.14.0", |
|||
"@nuxt/test-utils": "^3.23.0", |
|||
"@types/debug": "^4.1.12", |
|||
"@types/phc__format": "^1.0.1", |
|||
"@types/semver": "^7.7.1", |
|||
"@vitest/coverage-v8": "^4.0.18", |
|||
"@vitest/ui": "4.0.18", |
|||
"drizzle-kit": "^0.31.8", |
|||
"esbuild": "^0.27.3", |
|||
"eslint": "^9.39.2", |
|||
@ -67,6 +71,7 @@ |
|||
"prettier-plugin-tailwindcss": "^0.7.2", |
|||
"tsx": "^4.21.0", |
|||
"typescript": "^5.9.3", |
|||
"vitest": "^4.0.18", |
|||
"vue-tsc": "^3.2.4" |
|||
}, |
|||
"packageManager": "[email protected]" |
|||
|
|||
File diff suppressed because it is too large
@ -0,0 +1,20 @@ |
|||
import { expect, test, describe } from 'vitest'; |
|||
import { |
|||
hashPassword, |
|||
isPasswordValid, |
|||
isValidPasswordHash, |
|||
} from '../../server/utils/password'; |
|||
|
|||
describe('password', () => { |
|||
test('password', async () => { |
|||
const hash = await hashPassword('password'); |
|||
|
|||
await expect(isPasswordValid('password', hash)).resolves.toBe(true); |
|||
await expect(isPasswordValid('wrong', hash)).resolves.toBe(false); |
|||
|
|||
expect(isValidPasswordHash('not a hash')).toBe(false); |
|||
expect(isValidPasswordHash(hash)).toBe(true); |
|||
|
|||
expect(isValidPasswordHash(hash.replace('argon2', 'argon3'))).toBe(false); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,18 @@ |
|||
import { defineConfig } from 'vitest/config'; |
|||
|
|||
export default defineConfig({ |
|||
test: { |
|||
projects: [ |
|||
{ |
|||
test: { |
|||
name: 'unit', |
|||
include: ['test/unit/*.{test,spec}.ts'], |
|||
environment: 'node', |
|||
}, |
|||
}, |
|||
], |
|||
coverage: { |
|||
enabled: true, |
|||
}, |
|||
}, |
|||
}); |
|||
Loading…
Reference in new issue