Skip to content

Commit

Permalink
Convert portfolio model test.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianloveswords committed Nov 16, 2012
1 parent 1bac707 commit e7b1437
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 53 deletions.
53 changes: 0 additions & 53 deletions test/portfolio-model-test.js

This file was deleted.

35 changes: 35 additions & 0 deletions test/portfolio-model.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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);
})

0 comments on commit e7b1437

Please sign in to comment.