Skip to content

Commit

Permalink
Issue #43: added test in attempt to reproduce OrientDB.RequestError o…
Browse files Browse the repository at this point in the history
…n update
  • Loading branch information
dmarcelino committed Feb 18, 2015
1 parent deec3d2 commit 5d99b06
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
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);
});


});
});
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'
}
}
};
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'
}
}
};

0 comments on commit 5d99b06

Please sign in to comment.