monastery 1.28.2 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/model.js CHANGED
@@ -19,13 +19,13 @@ module.exports = function(monastery, opendb) {
19
19
  insertOnly: true,
20
20
  isInteger: true,
21
21
  timestampField: true,
22
- type: "integer",
22
+ type: 'integer',
23
23
  },
24
24
  updatedAt: {
25
25
  default: expect.any(Function),
26
26
  isInteger: true,
27
27
  timestampField: true,
28
- type: "integer",
28
+ type: 'integer',
29
29
  },
30
30
  })
31
31
 
@@ -79,13 +79,13 @@ module.exports = function(monastery, opendb) {
79
79
  insertOnly: true,
80
80
  isInteger: true,
81
81
  timestampField: true,
82
- type: "integer"
82
+ type: 'integer'
83
83
  },
84
84
  updatedAt: {
85
85
  default: expect.any(Function),
86
86
  isInteger: true,
87
87
  timestampField: true,
88
- type: "integer"
88
+ type: 'integer'
89
89
  }
90
90
  })
91
91
  })
@@ -115,7 +115,7 @@ module.exports = function(monastery, opendb) {
115
115
  })
116
116
  })
117
117
 
118
- test('Model indexes', async (done) => {
118
+ test('Model indexes', async () => {
119
119
  // Need to test different types of indexes
120
120
  let db = (await opendb(null)).db
121
121
 
@@ -129,10 +129,10 @@ module.exports = function(monastery, opendb) {
129
129
 
130
130
  // Unique & text index (after model initialisation, in serial)
131
131
  let userIndexRawModel = db.model('userIndexRaw', {})
132
- let setupIndex1 = await userIndexRawModel._setupIndexes({
132
+ await userIndexRawModel._setupIndexes({
133
133
  email: { type: 'string', index: 'unique' },
134
134
  })
135
- let setupIndex2 = await userIndexRawModel._setupIndexes({
135
+ await userIndexRawModel._setupIndexes({
136
136
  name: { type: 'string', index: 'text' },
137
137
  })
138
138
  let indexes = await db._db.collection('userIndexRaw').indexes()
@@ -170,28 +170,27 @@ module.exports = function(monastery, opendb) {
170
170
  textIndexVersion: 3
171
171
  })
172
172
 
173
- // No text index change error, i.e. new Error("Index with name: text already exists with different options")
173
+ // No text index change error, i.e. new Error('Index with name: text already exists with different options')
174
174
  await expect(userIndexModel._setupIndexes({
175
175
  name: { type: 'string', index: 'text' },
176
176
  name2: { type: 'string', index: 'text' }
177
177
  })).resolves.toEqual([{
178
- "key": { "name": "text", "name2": "text" },
179
- "name": "text",
178
+ 'key': { 'name': 'text', 'name2': 'text' },
179
+ 'name': 'text',
180
180
  }])
181
181
 
182
182
  // Text index on a different model
183
183
  await expect(userIndexRawModel._setupIndexes({
184
184
  name2: { type: 'string', index: 'text' }
185
185
  })).resolves.toEqual([{
186
- "key": {"name2": "text"},
187
- "name": "text",
186
+ 'key': {'name2': 'text'},
187
+ 'name': 'text',
188
188
  }])
189
189
 
190
190
  db.close()
191
- done()
192
191
  })
193
192
 
194
- test('Model 2dsphere indexes', async (done) => {
193
+ test('Model 2dsphere indexes', async () => {
195
194
  // Setup. The tested model needs to be unique as race condition issue arises when the same model
196
195
  // with text indexes are setup at the same time
197
196
  let db = (await opendb(null)).db
@@ -217,10 +216,10 @@ module.exports = function(monastery, opendb) {
217
216
  coordinates: expect.any(Array),
218
217
  schema: {
219
218
  default: undefined,
220
- index: "2dsphere",
219
+ index: '2dsphere',
221
220
  isObject: true,
222
221
  nullObject: undefined,
223
- type: "object"
222
+ type: 'object'
224
223
  }
225
224
  })
226
225
  expect(db.user3.fields.location2).toEqual({
@@ -228,10 +227,10 @@ module.exports = function(monastery, opendb) {
228
227
  coordinates: expect.any(Array),
229
228
  schema: {
230
229
  default: undefined,
231
- index: { type: "2dsphere" },
230
+ index: { type: '2dsphere' },
232
231
  isObject: true,
233
232
  nullObject: undefined,
234
- type: "object"
233
+ type: 'object'
235
234
  }
236
235
  })
237
236
 
@@ -244,17 +243,16 @@ module.exports = function(monastery, opendb) {
244
243
  _id: expect.any(Object),
245
244
  location: {
246
245
  coordinates: [172.5880385, -43.3311608],
247
- type: "Point"
246
+ type: 'Point'
248
247
  },
249
248
  })
250
249
 
251
250
  db.close()
252
- done()
253
251
  })
254
252
 
255
- test('Model findBL, findBLProject', async (done) => {
253
+ test('Model findBL, findBLProject', async () => {
256
254
  let db = (await opendb(null)).db
257
- let bird = db.model('bird', { fields: {
255
+ db.model('bird', { fields: {
258
256
  name: { type: 'string' }
259
257
  }})
260
258
  let user = db.model('user', {
@@ -355,8 +353,8 @@ module.exports = function(monastery, opendb) {
355
353
  'hiddenDeepModel': 0,
356
354
  'hiddenDeepModels': 0,
357
355
  // Deep model blacklists
358
- "deepModel.myBird.password": 0,
359
- "deepModel2.myBird.password": 0
356
+ 'deepModel.myBird.password': 0,
357
+ 'deepModel2.myBird.password': 0
360
358
  })
361
359
 
362
360
  // Test whitelisting
@@ -415,7 +413,6 @@ module.exports = function(monastery, opendb) {
415
413
  })
416
414
 
417
415
  db.close()
418
- done()
419
416
  })
420
417
 
421
418
  }
package/test/monk.js CHANGED
@@ -1,10 +1,10 @@
1
1
  module.exports = function(monastery, opendb) {
2
2
 
3
- test('Monk confilicts', async (done) => {
3
+ test('Monk confilicts', async () => {
4
4
  // Setup
5
5
  let db = (await opendb(false)).db
6
6
  let monkdb = require('monk')(':badconnection', () => {})
7
- let user = db.model('user', {})
7
+ db.model('user', {})
8
8
  let modelNamedConnected = db.model('connected', {})
9
9
 
10
10
  // Any of our monastery properties already exist on the manager?
@@ -19,8 +19,8 @@ module.exports = function(monastery, opendb) {
19
19
  expect(db.connected).toEqual(db.connected)
20
20
  expect(db.model.connected).toEqual(modelNamedConnected)
21
21
 
22
- // Close test since monk(uri) awaits upoin a connection
23
- done()
22
+ // Close test since monk(uri) awaits upoin a connection (Update, done not needed in latest jest)
23
+ // done()
24
24
  })
25
25
 
26
26
  test('Monastery connect with promise', (done) => {