(options?: { dangerouslyAllowRawSql?: boolean; dbName: string })
| 37 | } |
| 38 | |
| 39 | async function createPolicyClient(options?: { dangerouslyAllowRawSql?: boolean; dbName: string }) { |
| 40 | const unsafeClient = await createTestClient(schema, { |
| 41 | dbName: options?.dbName, |
| 42 | plugins: [new PolicyPlugin({ dangerouslyAllowRawSql: options?.dangerouslyAllowRawSql })], |
| 43 | }); |
| 44 | clients.push(unsafeClient); |
| 45 | |
| 46 | const rawClient = unsafeClient.$unuseAll(); |
| 47 | const adminClient = unsafeClient.$setAuth({ id: 'admin', role: 'admin' }); |
| 48 | |
| 49 | await rawClient.user.create({ |
| 50 | data: { |
| 51 | id: 'admin', |
| 52 | role: 'admin', |
| 53 | }, |
| 54 | }); |
| 55 | |
| 56 | return { adminClient }; |
| 57 | } |
| 58 | |
| 59 | it('keeps rejecting raw SQL by default', async () => { |
| 60 | const { adminClient } = await createPolicyClient({ dbName: 'policy_raw_sql_default' }); |
no test coverage detected