Skip to content

Commit

Permalink
Fixing test
Browse files Browse the repository at this point in the history
  • Loading branch information
mkdbns committed Jul 8, 2017
1 parent 17dc927 commit 044b9f6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 25 deletions.
72 changes: 50 additions & 22 deletions lib/modules/test/fixtures/posts.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
module.exports = [{
msg_id: '3334',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2017-06-05T20:08:38.263Z',
body_string: 'that is when I came on again',
body_text: ''
}, {
msg_id: '3315',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2017-06-05T20:08:38.263Z',
body_string: 'I meant thick',
body_text: ''
}, {
msg_id: '1',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2013-06-13T14:08:50.383Z',
body_string: '',
body_text: ''
}]
module.exports = {

ok: [{
msg_id: '3315',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2017-06-05T20:08:38.263Z',
body_string: 'I meant thick',
body_text: ''
}, {
msg_id: '3334',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2017-06-05T20:08:38.263Z',
body_string: 'that is when I came on again',
body_text: ''
}],

userNotFound: [{
msg_id: '3334',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2017-06-05T20:08:38.263Z',
body_string: 'that is when I came on again',
body_text: ''
}, {
msg_id: '3315',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2017-06-05T20:08:38.263Z',
body_string: 'I meant thick',
body_text: ''
}],

bodyNotFound: [{
msg_id: '3315',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2017-06-05T20:08:38.263Z',
body_string: 'I meant thick',
body_text: ''
}, {
msg_id: '1',
to_jid: '[email protected]',
from_jid: '[email protected]',
sent_date: '2013-06-13T14:08:50.383Z',
body_string: '',
body_text: ''
}]
}
5 changes: 2 additions & 3 deletions lib/modules/test/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('modules.posts', function() {
// Stub the data source
//
context.jabber.pipe.callsFake(function(query, writable) {
Fixtures.posts.forEach(function(post) {
Fixtures.posts.ok.forEach(function(post) {
writable.write(post)
})
writable.end()
Expand All @@ -68,7 +68,7 @@ describe('modules.posts', function() {
//
posts(context).then(function(c) {
expect(c).to.equal(context)
expect(context.output.write.callCount).to.equal(1)
expect(context.output.write.callCount).to.equal(2)

let post = c.output.write.args[0][0]
expect(post).to.deep.equal({
Expand All @@ -82,7 +82,6 @@ describe('modules.posts', function() {
}
})
expect(new Date(post.post.create_at).toISOString()).to.equal('2017-06-05T20:08:38.263Z')

done()
}).catch(function(e){
expect(e).to.be.undefined
Expand Down

0 comments on commit 044b9f6

Please sign in to comment.