Skip to content

Commit d65b423

Browse files
committed
test: add handle unicode flash messages test
1 parent a8b09cd commit d65b423

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/flash-test.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ var flash = require('flash');
77
function MockRequest() {
88
this.session = {};
99
}
10-
11-
function MockRequestWithoutSession() {
12-
}
13-
14-
function MockResponse() {
15-
}
10+
function MockRequestWithoutSession() {}
11+
function MockResponse() {}
1612

1713

1814
vows.describe('flash').addBatch({
@@ -54,6 +50,15 @@ vows.describe('flash').addBatch({
5450
assert.equal(msgs[0], 'Something went wrong');
5551
assert.lengthOf(Object.keys(req.session.flash), 0);
5652
},
53+
'should set/get flash unicode message' : function(err, req, res) {
54+
const count = req.flash('error', 'a Ā 𐀀 文 🦄');
55+
assert.equal(count, 1);
56+
assert.equal(req.session.flash.error[0], 'YSDEgCDwkICAIOaWhyDwn6aE');
57+
const msgs = req.flash('error');
58+
assert.lengthOf(msgs, 1);
59+
assert.equal(msgs[0], 'a Ā 𐀀 文 🦄');
60+
assert.lengthOf(Object.keys(req.session.flash), 0);
61+
},
5762
'should set multiple flash messages' : function(err, req, res) {
5863
req.flash('info', 'Welcome');
5964
var count = req.flash('info', 'Check out this great new feature');

0 commit comments

Comments
 (0)