forked from mozilla/openbadges-backpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathportfolio-model.test.js
35 lines (28 loc) · 1005 Bytes
/
portfolio-model.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const test = require('tap').test;
const testUtils = require('./');
const Portfolio = require('../models/portfolio');
const User = require('../models/user');
const Group = require('../models/group');
const UNICODE_TITLE = "てすと";
testUtils.prepareDatabase({
'1-user': new User({ email: '[email protected]' }),
'2-group': new Group({ user_id: 1, name: 'lol', badges: [] })
}, function () {
test('Portfolio#save: unicode characters in the title', function (t) {
const portfolio = new Portfolio({
group_id: 1,
title: UNICODE_TITLE,
stories: {}
});
portfolio.save(function (err, result) {
t.notOk(err, 'should not have an error');
Portfolio.findOne({ title: UNICODE_TITLE }, function (err, result) {
t.notOk(err, 'should not have an error');
t.ok(result, 'should have a result')
t.same(result.get('title'), UNICODE_TITLE, 'should have the correct title');
t.end();
});
});
});
testUtils.finish(test);
})