This commit is contained in:
2026-05-13 19:58:16 +03:00
commit f5adeb292b
78 changed files with 12024 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
const expect = require('chai').expect
const directChannels = require('../directChannels')
const Fixtures = require('./fixtures')
const FakeDB = require('./fakedb')
const sink = require('./sink')
const context = require('./context')()
describe('modules.directChannels', function() {
before(function() {
//
// Set up context values
//
context.values = {
users: {
'person.one@example.com': {
username: 'person.one'
},
'person.two@example.com': {
username: 'person.two'
},
'person.three@example.com': {
username: 'person.three'
}
}
}
})
beforeEach(function() {
//
// Stub the output stream
//
context.output = sink()
})
it('should process direct channel objects', function(done) {
//
// Set up the DB
//
context.jabber = new FakeDB(Fixtures.directChannels)
//
// Process the data
//
directChannels(context).then(function(c) {
expect(c).to.equal(context)
expect(c.output.write.args).to.deep.equal(
[
[
{
type: 'direct_channel',
direct_channel: {
members: ['person.one', 'person.two']
}
}
],
[
{
type: 'direct_channel',
direct_channel: {
members: ['person.one', 'person.three']
}
}
]
]
)
done()
})
})
})