monastery 1.28.3 → 1.30.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/populate.js CHANGED
@@ -1,6 +1,6 @@
1
1
  module.exports = function(monastery, opendb) {
2
2
 
3
- test('Model populate', async (done) => {
3
+ test('Model populate', async () => {
4
4
  // Setup
5
5
  let db = (await opendb(null)).db
6
6
  let bird = db.model('bird', { fields: {
@@ -30,7 +30,7 @@ module.exports = function(monastery, opendb) {
30
30
  name: 'Martin Luther',
31
31
  myBird: {
32
32
  _id: bird1._id,
33
- name: "ponyo"
33
+ name: 'ponyo'
34
34
  },
35
35
  pets: {
36
36
  myBird: bird1._id
@@ -46,7 +46,7 @@ module.exports = function(monastery, opendb) {
46
46
  pets: {
47
47
  myBird: {
48
48
  _id: bird1._id,
49
- name: "ponyo"
49
+ name: 'ponyo'
50
50
  },
51
51
  }
52
52
  })
@@ -62,7 +62,7 @@ module.exports = function(monastery, opendb) {
62
62
  name: 'Martin Luther',
63
63
  myBird: {
64
64
  _id: bird1._id,
65
- name: "ponyo"
65
+ name: 'ponyo'
66
66
  },
67
67
  pets: {
68
68
  myBird: bird1._id
@@ -72,7 +72,7 @@ module.exports = function(monastery, opendb) {
72
72
  name: 'Martin Luther2',
73
73
  myBird: {
74
74
  _id: bird1._id,
75
- name: "ponyo"
75
+ name: 'ponyo'
76
76
  },
77
77
  pets: {
78
78
  myBird: bird1._id
@@ -80,10 +80,9 @@ module.exports = function(monastery, opendb) {
80
80
  }])
81
81
 
82
82
  db.close()
83
- done()
84
83
  })
85
84
 
86
- test('Model populate type=any', async (done) => {
85
+ test('Model populate type=any', async () => {
87
86
  let db = (await opendb(null)).db
88
87
  db.model('company', { fields: {
89
88
  address: { type: 'any' }
@@ -131,10 +130,9 @@ module.exports = function(monastery, opendb) {
131
130
  })
132
131
 
133
132
  db.close()
134
- done()
135
133
  })
136
134
 
137
- test('Model populate/blacklisting via $lookup', async (done) => {
135
+ test('Model populate/blacklisting via $lookup', async () => {
138
136
  // Setup
139
137
  let db = (await opendb(null)).db
140
138
  let user = db.model('user', {
@@ -167,10 +165,10 @@ module.exports = function(monastery, opendb) {
167
165
  let find1 = await user.findOne({
168
166
  query: user1._id,
169
167
  populate: [{
170
- "as": "birds",
171
- "from": "bird",
172
- "let": { id: "$_id" },
173
- "pipeline": [
168
+ 'as': 'birds',
169
+ 'from': 'bird',
170
+ 'let': { id: '$_id' },
171
+ 'pipeline': [
174
172
  { $match: { $expr: { $eq: ['$owner', '$$id'] }}}
175
173
  ]
176
174
  }]
@@ -193,10 +191,10 @@ module.exports = function(monastery, opendb) {
193
191
  let find2 = await user.findOne({
194
192
  query: user1._id,
195
193
  populate: [{
196
- "as": "anyModel",
197
- "from": "bird",
198
- "let": { id: "$_id" },
199
- "pipeline": [
194
+ 'as': 'anyModel',
195
+ 'from': 'bird',
196
+ 'let': { id: '$_id' },
197
+ 'pipeline': [
200
198
  { $match: { $expr: { $eq: ['$owner', '$$id'] }}}
201
199
  ]
202
200
  }]
@@ -217,7 +215,6 @@ module.exports = function(monastery, opendb) {
217
215
  })
218
216
 
219
217
  db.close()
220
- done()
221
218
  })
222
219
 
223
220
  }
package/test/util.js CHANGED
@@ -10,10 +10,10 @@ module.exports = function(monastery, opendb) {
10
10
  'deep[companyLogos][0]': 'b',
11
11
  'deep[companyLogos2][0][logo]':'c',
12
12
  'deep[companyLogos2][1][logo]': '',
13
- "users[0][first]": "Martin",
14
- "users[0][last]": "Luther",
15
- "users[1][first]": "Bruce",
16
- "users[1][last]": "Lee",
13
+ 'users[0][first]': 'Martin',
14
+ 'users[0][last]': 'Luther',
15
+ 'users[1][first]': 'Bruce',
16
+ 'users[1][last]': 'Lee',
17
17
  })).toEqual({
18
18
  name: 'Martin',
19
19
  pets: expect.any(Array),
@@ -23,12 +23,12 @@ module.exports = function(monastery, opendb) {
23
23
  companyLogos2: [{ logo: 'c' }, { logo: '' }]
24
24
  },
25
25
  users: [
26
- { "first": "Martin", "last": "Luther" },
27
- { "first": "Bruce", "last": "Lee" },
26
+ { 'first': 'Martin', 'last': 'Luther' },
27
+ { 'first': 'Bruce', 'last': 'Lee' },
28
28
  ]
29
29
  })
30
- expect(util.parseFormData({ "users[]['name']": 'Martin' })).rejects
31
- .toEqual(`Array items in bracket notation need array indexes "users[]['name']", e.g. users[0][name]`)
30
+ expect(util.parseFormData({ 'users[][\'name\']': 'Martin' })).rejects
31
+ .toEqual('Array items in bracket notation need array indexes "users[][\'name\']", e.g. users[0][name]')
32
32
  })
33
33
 
34
34
  test('Utilities: isId', async () => {