Skip to content

Commit da40045

Browse files
committed
Use yarn, test with node 7.x and update deps
1 parent 0085141 commit da40045

File tree

5 files changed

+2639
-25
lines changed

5 files changed

+2639
-25
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: node_js
22
node_js:
3+
- "7"
34
- "6"
45
- "5"
56
services:

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exports.default = function (schema, opts) {
3737
return this.patches.find({ ref: this.id }).sort({ date: 1 }).exec().then(function (patches) {
3838
return new _bluebird2.default(function (resolve, reject) {
3939
// patch doesn't exist
40-
if (! ~(0, _lodash.map)(patches, 'id').indexOf(patchId)) {
40+
if (!~(0, _lodash.map)(patches, 'id').indexOf(patchId)) {
4141
return reject(new RollbackError('patch doesn\'t exist'));
4242
}
4343

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
"author": "Christoph Werner <christoph@codepunkt.de>",
77
"license": "MIT",
88
"dependencies": {
9-
"fast-json-patch": "^0.5.7",
10-
"humps": "^1.1.0",
11-
"lodash": "^4.11.1",
12-
"mongoose": "^4.4.14"
9+
"fast-json-patch": "^1.1.4",
10+
"humps": "^2.0.0",
11+
"lodash": "^4.17.4",
12+
"mongoose": "^4.8.1"
1313
},
1414
"devDependencies": {
15-
"babel-cli": "^6.7.7",
16-
"babel-preset-es2015": "^6.6.0",
17-
"bluebird": "^3.3.5",
18-
"coveralls": "^2.11.9",
19-
"eslint": "^2.9.0",
20-
"eslint-config-standard": "^5.2.0",
21-
"eslint-plugin-promise": "^1.1.0",
22-
"eslint-plugin-standard": "^1.3.2",
23-
"istanbul": "^1.0.0-alpha.2",
24-
"mocha": "^2.4.5",
25-
"pre-commit": "^1.1.2"
15+
"babel-cli": "^6.22.2",
16+
"babel-preset-es2015": "^6.22.0",
17+
"bluebird": "^3.4.7",
18+
"coveralls": "^2.11.15",
19+
"eslint": "^3.14.1",
20+
"eslint-config-standard": "^6.2.1",
21+
"eslint-plugin-promise": "^3.4.0",
22+
"eslint-plugin-standard": "^2.0.1",
23+
"istanbul": "^0.4.5",
24+
"mocha": "^3.2.0",
25+
"pre-commit": "^1.2.2"
2626
},
2727
"scripts": {
2828
"addCompile": "git add lib/",

test/index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Promise, { join } from 'bluebird'
44
import mongoose, { Schema } from 'mongoose'
55
import patchHistory, { RollbackError } from '../src'
66

7+
mongoose.Promise = Promise
78
const ObjectId = mongoose.Types.ObjectId
89

910
const CommentSchema = new Schema({ text: String })
@@ -93,19 +94,21 @@ describe('mongoose-patch-history', () => {
9394
.then((post) => post.patches.find({ ref: post.id }))
9495
.then((patches) => {
9596
assert.equal(patches.length, 1)
96-
assert.deepEqual(patches[0].ops, [
97-
{ value: 'foo', path: '/title', op: 'add' }
98-
])
97+
assert.equal(
98+
JSON.stringify(patches[0].ops),
99+
JSON.stringify([{ value: 'foo', path: '/title', op: 'add' }])
100+
)
99101
}),
100102
// with referenced user
101103
User.findOne()
102104
.then((user) => Comment.create({ text: 'wat', user: ObjectId() }))
103105
.then((comment) => comment.patches.find({ ref: comment.id }))
104106
.then((patches) => {
105107
assert.equal(patches.length, 1)
106-
assert.deepEqual(patches[0].ops, [
107-
{ value: 'wat', path: '/text', op: 'add' }
108-
])
108+
assert.equal(
109+
JSON.stringify(patches[0].ops),
110+
JSON.stringify([{ value: 'wat', path: '/text', op: 'add' }])
111+
)
109112
})
110113
).then(() => done()).catch(done)
111114
})
@@ -118,9 +121,10 @@ describe('mongoose-patch-history', () => {
118121
.then((post) => post.patches.find({ ref: post.id }).sort({ _id: 1 }))
119122
.then((patches) => {
120123
assert.equal(patches.length, 2)
121-
assert.deepEqual(patches[1].ops, [
122-
{ value: 'bar', path: '/title', op: 'replace' }
123-
])
124+
assert.equal(
125+
JSON.stringify(patches[1].ops),
126+
JSON.stringify([{ value: 'bar', path: '/title', op: 'replace' }])
127+
)
124128
}).then(done).catch(done)
125129
})
126130

0 commit comments

Comments
 (0)