-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.ts
51 lines (47 loc) · 1.03 KB
/
data.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { factory, primaryKey } from '@mswjs/data';
// Enable the following line to suppress MaxListenersExceededWarning when defining many models using mswjs
// However, this method is not recommended as it applies to all Event Emitters.
//
// import { EventEmitter } from 'events';
// EventEmitter.defaultMaxListeners = 11;
export const db = factory({
model1: {
id: primaryKey(String),
},
model2: {
id: primaryKey(String),
},
model3: {
id: primaryKey(String),
},
model4: {
id: primaryKey(String),
},
model5: {
id: primaryKey(String),
},
model6: {
id: primaryKey(String),
},
model7: {
id: primaryKey(String),
},
model8: {
id: primaryKey(String),
},
model9: {
id: primaryKey(String),
},
model10: {
id: primaryKey(String),
},
// Warning disappears after removing model11
model11: {
id: primaryKey(String),
},
});
// If you do model.create, more warnings will occur.
[...Array(3)].forEach((_, i) => {
db.model1.create({id: i.toString()})
})
export default db;