-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #43: added test in attempt to reproduce OrientDB.RequestError o…
…n update
- Loading branch information
1 parent
deec3d2
commit 5d99b06
Showing
3 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
test/integration-orientdb/bugs/43-orientdb_requestError/43-orientdb_requestError.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var assert = require('assert'), | ||
_ = require('lodash'), | ||
utils = require('../../../../lib/utils'); | ||
|
||
var self = this; | ||
|
||
describe('Bug #43: OrientDB.RequestError on update', function() { | ||
before(function (done) { | ||
var fixtures = { | ||
ImageFixture: require('./image.fixture'), | ||
SubprofileFixture: require('./post.fixture') | ||
}; | ||
CREATE_TEST_WATERLINE(self, 'test_bug_43', fixtures, done); | ||
}); | ||
after(function (done) { | ||
DELETE_TEST_WATERLINE('test_bug_43', done); | ||
}); | ||
|
||
describe('update a created post', function() { | ||
///////////////////////////////////////////////////// | ||
// TEST SETUP | ||
//////////////////////////////////////////////////// | ||
|
||
var postRecord; | ||
|
||
before(function(done) { | ||
self.collections.Post.create({ title: 'a post' }, function(err, post) { | ||
if(err) { return done(err); } | ||
postRecord = post; | ||
done(); | ||
}); | ||
}); | ||
|
||
|
||
///////////////////////////////////////////////////// | ||
// TEST METHODS | ||
//////////////////////////////////////////////////// | ||
|
||
it('should update a post', function(done) { | ||
self.collections.Post.findOne(postRecord.id) | ||
.then(function(post){ | ||
|
||
post.title = 'new title'; | ||
|
||
self.collections.Post.update({ id: post.id }, post, done); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
|
||
}); | ||
}); |
31 changes: 31 additions & 0 deletions
31
test/integration-orientdb/bugs/43-orientdb_requestError/image.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module.exports = { | ||
|
||
identity: 'image', | ||
|
||
attributes: { | ||
file: { | ||
type: 'json', | ||
isFile: true, | ||
required: true | ||
}, | ||
footer: { | ||
type: 'string' | ||
}, | ||
// author: { | ||
// model: 'author' | ||
// }, | ||
area: { | ||
type: 'string' | ||
}, | ||
isCrop: { | ||
type: 'boolean' | ||
}, | ||
parent: { | ||
model: 'image' | ||
}, | ||
crops: { | ||
collection: 'image', | ||
via: 'parent' | ||
} | ||
} | ||
}; |
65 changes: 65 additions & 0 deletions
65
test/integration-orientdb/bugs/43-orientdb_requestError/post.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
module.exports = { | ||
|
||
identity: 'post', | ||
|
||
attributes: { | ||
title: { | ||
type: 'string' | ||
}, | ||
slug: { | ||
type: 'string' | ||
}, | ||
editorialPriority: { | ||
type: 'string' | ||
}, | ||
sectionPriority: { | ||
type: 'string' | ||
}, | ||
html: { | ||
type: 'string' | ||
}, | ||
editor_html: { | ||
type: 'string' | ||
}, | ||
featureImage: { | ||
model: 'image' | ||
}, | ||
area: { | ||
type: 'string' | ||
}, | ||
excerpt: { | ||
type: 'string' | ||
}, | ||
content: { | ||
type: 'string', | ||
}, | ||
publicationDate: { | ||
type: 'datetime' | ||
}, | ||
// categories:{ | ||
// collection: 'category', | ||
// through: 'post_category', | ||
// via: 'post', | ||
// dominant: true | ||
// }, | ||
// author:{ | ||
// model:'author' | ||
// }, | ||
// status:{ | ||
// model:'postStatus' | ||
// }, | ||
address: { | ||
type: 'string' | ||
}, | ||
addressReference: { | ||
type: 'string' | ||
}, | ||
latitude: { | ||
type: 'float' | ||
}, | ||
longitude: { | ||
type: 'float' | ||
} | ||
} | ||
}; |