Skip invalid attachments and make function sync

pull/1/head
Daniel Gasienica 7 years ago
parent 3dfc823716
commit add4b11df3

@ -176,7 +176,12 @@ exports._replaceUnicodeOrderOverridesSync = (attachment) => {
exports.replaceUnicodeOrderOverrides = async attachment =>
exports._replaceUnicodeOrderOverridesSync(attachment);
exports.removeSchemaVersion = async (attachment) => {
exports.removeSchemaVersion = (attachment) => {
if (!exports.isValid(attachment)) {
console.log('Attachment.removeSchemaVersion: Invalid input attachment:', attachment);
return attachment;
}
const attachmentWithoutSchemaVersion = Object.assign({}, attachment);
delete attachmentWithoutSchemaVersion.schemaVersion;
return attachmentWithoutSchemaVersion;

@ -245,7 +245,7 @@ describe('Attachment', () => {
});
describe('removeSchemaVersion', () => {
it('should remove existing schema version', async () => {
it('should remove existing schema version', () => {
const input = {
contentType: 'image/jpeg',
data: null,
@ -261,7 +261,7 @@ describe('Attachment', () => {
size: 1111,
};
const actual = await Attachment.removeSchemaVersion(input);
const actual = Attachment.removeSchemaVersion(input);
assert.deepEqual(actual, expected);
});
});

Loading…
Cancel
Save