Skip to content

Commit f48cf27

Browse files
committed
[test]: query composite key test;
1 parent 8e4f1a6 commit f48cf27

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

__tests__/query.test.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Database, DataClass, KeyPath, Index } from "../index";
1+
import { Database, DataClass, KeyPath, Index, CompositeKeyPath } from "../index";
22

33
// Test entities for coverage improvement
44
@DataClass()
@@ -23,6 +23,34 @@ class CoverageUser {
2323
}
2424
}
2525

26+
@DataClass({ version: 1 })
27+
class RandomKeyEntity {
28+
@KeyPath({ generator: 'random' })
29+
id!: string;
30+
31+
name!: string;
32+
33+
constructor(name: string) {
34+
this.name = name;
35+
}
36+
}
37+
38+
@DataClass({ version: 1 })
39+
@CompositeKeyPath(['userId', 'projectId'])
40+
class CompositeEntity {
41+
userId!: string;
42+
projectId!: string;
43+
44+
@Index()
45+
role!: string;
46+
47+
constructor(userId: string, projectId: string, role: string) {
48+
this.userId = userId;
49+
this.projectId = projectId;
50+
this.role = role;
51+
}
52+
}
53+
2654
describe('Coverage Improvement Tests', () => {
2755
let db: any;
2856

0 commit comments

Comments
 (0)