Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('resolves with a mapped cancelled upload asset message', () => {
const asset = new Asset({notUploaded: Asset.NotUploaded.CANCELLED});
const generic_message = new GenericMessage({
[GENERIC_MESSAGE_TYPE.ASSET]: asset,
messageId: createRandomUuid(),
});
return mapper.mapGenericMessage(generic_message, event).then(event_json => {
expect(isObject(event_json)).toBeTruthy();
expect(event_json.type).toBe(ClientEvent.CONVERSATION.ASSET_ADD);
expect(event_json.conversation).toBe(event.conversation);
expect(event_json.from).toBe(event.from);
expect(event_json.time).toBe(event.time);
expect(event_json.id).toBe(generic_message.messageId);
expect(event_json.data.reason).toBe(Asset.NotUploaded.CANCELLED);
});
});
return mapper.mapGenericMessage(generic_message, event).then(event_json => {
expect(isObject(event_json)).toBeTruthy();
expect(event_json.type).toBe(ClientEvent.CONVERSATION.ASSET_ADD);
expect(event_json.conversation).toBe(event.conversation);
expect(event_json.from).toBe(event.from);
expect(event_json.time).toBe(event.time);
expect(event_json.id).toBe(generic_message.messageId);
expect(event_json.data.reason).toBe(Asset.NotUploaded.CANCELLED);
});
});