File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
tests/integration/tests/enhancements/with-encrypted Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import { loadSchema } from '@zenstackhq/testtools' ;
2+ import path from 'path' ;
3+
4+ describe ( 'Encrypted test' , ( ) => {
5+ let origDir : string ;
6+
7+ beforeAll ( async ( ) => {
8+ origDir = path . resolve ( '.' ) ;
9+ } ) ;
10+
11+ afterEach ( async ( ) => {
12+ process . chdir ( origDir ) ;
13+ } ) ;
14+
15+ it ( 'encrypted tests' , async ( ) => {
16+ const { enhance } = await loadSchema ( `
17+ model User {
18+ id String @id @default(cuid())
19+ encrypted_value String @encrypted(saltLength: 16)
20+
21+ @@allow('all', true)
22+ }` ) ;
23+
24+ const db = enhance ( ) ;
25+ const r = await db . user . create ( {
26+ data : {
27+ id : '1' ,
28+ encrypted_value : 'abc123' ,
29+ } ,
30+ } ) ;
31+
32+ expect ( r . encrypted_value ) . toBe ( 'abc123' ) ;
33+ } ) ;
34+ } ) ;
You can’t perform that action at this time.
0 commit comments