Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit c06f6df

Browse files
fixed tests
1 parent 5794c1c commit c06f6df

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

server/hooks/create-excerpt.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ module.exports = function (options = {}) { // eslint-disable-line no-unused-vars
3737
const contentBefore = trunc(content, 9999999999);
3838
const contentTruncated = trunc(contentSanitized, options.length);
3939

40-
// save meta key hasMore to indecate if there is more text then in the excerpt
40+
// save meta key hasMore to indicate if there is more text then in the excerpt
4141
const hasMore = contentBefore.text.length > (contentTruncated.text.length + 20);
4242
setByDot(hook.data, 'hasMore', hasMore);
4343

4444
// set excerpt
4545
setByDot(hook.data, `${options.field}Excerpt`, hasMore ? contentTruncated.html : content.replace(/(\ ){2,}/ig, ' '))
4646
} catch (err) {
47-
hook.app.error(err);
48-
throw new Error(err);
47+
// hook.app.error(err);
48+
// throw new Error(err);
4949
}
5050
// trim content
5151
setByDot(hook.data, options.field, content.replace(/(\ ){2,}/ig, ' '));

server/services/auth-management/notifier.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ module.exports = function (app) {
111111

112112
function sendEmail (email) {
113113
// Save copy to /tmp/emails while in debug mode
114-
if (app.get('debug')) {
114+
if (process.env.NODE_ENV !== 'production') {
115115
const filename = String(Date.now()) + '.html';
116116
const filepath = path.join(__dirname, '../../../tmp/emails/', filename);
117117
fs.outputFileSync(filepath, email.html);
@@ -126,6 +126,7 @@ module.exports = function (app) {
126126
.catch(err => {
127127
if (process.env.NODE_ENV !== 'test') {
128128
app.error('Error sending email', err);
129+
app.debug(err.message);
129130
}
130131
});
131132
}

test/services/contributions.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ describe('\'contributions\' service', () => {
6767

6868
it('creates mention notification', async () => {
6969
const mentionedUser = await userService.create(userData);
70-
const data = {...contributionData};
71-
data.content = `<a href="" class="hc-editor-mention-blot" data-hc-mention="{&quot;_id&quot;:&quot;${mentionedUser._id.toString()}&quot;,&quot;slug&quot;:&quot;${mentionedUser.slug}&quot;}">${mentionedUser.name}</a>`;
70+
const data = Object.assign({}, contributionData);
71+
data.content += ` <a href="" class="hc-editor-mention-blot" data-hc-mention="{&quot;_id&quot;:&quot;${mentionedUser._id.toString()}&quot;,&quot;slug&quot;:&quot;${mentionedUser.slug}&quot;}">${mentionedUser.name}</a>`;
7272
const contribution = await service.create(data, params);
7373
const result = await notificationService.find({
7474
query: {
75-
userId: mentionedUser._id
75+
userId: mentionedUser._id.toString()
7676
}
7777
});
7878
const notification = result.data[0];
@@ -176,4 +176,4 @@ describe('\'contributions\' service', () => {
176176
assert.ok(result.data[0].associatedCanDos[0], 'finds result');
177177
});
178178
});
179-
});
179+
});

0 commit comments

Comments
 (0)