Remove messageCollection from Conversation model

This commit is contained in:
Scott Nonnenberg 2021-06-15 17:44:14 -07:00 committed by GitHub
parent 61ad1231df
commit 1520c80013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 332 additions and 431 deletions

View file

@ -75,42 +75,6 @@ describe('Message', () => {
assert.isTrue(message.get('sent'));
});
it("triggers the 'done' event on success", async () => {
const message = createMessage({ type: 'outgoing', source });
let callCount = 0;
message.on('done', () => {
callCount += 1;
});
await message.send(Promise.resolve({}));
assert.strictEqual(callCount, 1);
});
it("triggers the 'sent' event on success", async () => {
const message = createMessage({ type: 'outgoing', source });
const listener = sinon.spy();
message.on('sent', listener);
await message.send(Promise.resolve({}));
sinon.assert.calledOnce(listener);
sinon.assert.calledWith(listener, message);
});
it("triggers the 'done' event on failure", async () => {
const message = createMessage({ type: 'outgoing', source });
const listener = sinon.spy();
message.on('done', listener);
await message.send(Promise.reject(new Error('something went wrong!')));
sinon.assert.calledOnce(listener);
});
it('saves errors from promise rejections with errors', async () => {
const message = createMessage({ type: 'outgoing', source });