Skip to content

Commit 8dc9d57

Browse files
committed
fix: test
1 parent ab9931c commit 8dc9d57

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

tests/password-policy.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { randomUUID } from 'node:crypto'
33
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
44

55
import { checkOrgReadAccess } from '../supabase/functions/_backend/private/validate_password_compliance.ts'
6-
import { BASE_URL, getSupabaseClient, headers, TEST_EMAIL, USER_EMAIL, USER_ID, USER_ID_2, USER_PASSWORD } from './test-utils.ts'
6+
import { BASE_URL, executeSQL, getSupabaseClient, headers, TEST_EMAIL, USER_EMAIL, USER_ID, USER_ID_2, USER_PASSWORD, USER_PASSWORD_HASH } from './test-utils.ts'
77

88
const ORG_ID = randomUUID()
99
const globalId = randomUUID()
@@ -310,6 +310,19 @@ describe('[POST] /private/validate_password_compliance', () => {
310310
const nonMemberPassword = USER_PASSWORD
311311
const supabase = getSupabaseClient()
312312

313+
await executeSQL(
314+
`INSERT INTO auth.users (id, email, encrypted_password, email_confirmed_at, created_at, updated_at, raw_user_meta_data)
315+
VALUES ($1, $2, $3, NOW(), NOW(), NOW(), '{}'::jsonb)
316+
ON CONFLICT (id) DO NOTHING`,
317+
[USER_ID, USER_EMAIL, USER_PASSWORD_HASH],
318+
)
319+
await executeSQL(
320+
`INSERT INTO public.users (id, email, created_at, updated_at)
321+
VALUES ($1, $2, NOW(), NOW())
322+
ON CONFLICT (id) DO NOTHING`,
323+
[USER_ID, USER_EMAIL],
324+
)
325+
313326
await supabase.from('stripe_info').insert({
314327
customer_id: nonMemberCustomerId,
315328
status: 'succeeded',

tests/test-utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export const APP_NAME_ENCRYPTED = 'com.encrypted.app'
103103
export const STRIPE_CUSTOMER_ID_ENCRYPTED = 'cus_encrypted_test_123'
104104
export const USER_EMAIL = 'test@capgo.app'
105105
export const USER_PASSWORD = 'testtest'
106+
export const USER_PASSWORD_HASH = '$2a$10$0CErXxryZPucjJWq3O7qXeTJgN.tnNU5XCZy9pXKDWRi/aS9W7UFi'
106107
export const TEST_EMAIL = 'test@test.com'
107108
export const USER_ID_NONMEMBER = '11111111-1111-4111-8111-111111111110'
108109
export const USER_EMAIL_NONMEMBER = 'nonmember@capgo.app'

0 commit comments

Comments
 (0)