fix(tests): do not error when test chat messages miss the timestamp attribute

This commit is contained in:
Matteo Pagliazzi
2018-05-18 18:04:32 +02:00
parent 2132a3a242
commit ac973ee753

View File

@@ -348,7 +348,7 @@ schema.statics.toJSONCleanChat = async function groupToJSONCleanChat (group, use
toJSON.chat.forEach(chat => {
// old chats are saved with a numeric timestamp
// new chats use `Date` which then has to be converted to the numeric timestamp
if (chat.timestamp.getTime) {
if (chat.timestamp && chat.timestamp.getTime) {
chat.timestamp = chat.timestamp.getTime();
}
});