From c9d8536872e310550a247e4bcd28d4f75eef3d13 Mon Sep 17 00:00:00 2001 From: Andrew Naylor Date: Mon, 2 Mar 2015 18:46:10 +0000 Subject: [PATCH] The encoding must be respected when trimming --- test/notification.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/notification.js b/test/notification.js index a590a23..d74c152 100644 --- a/test/notification.js +++ b/test/notification.js @@ -156,6 +156,14 @@ describe("Notification", function() { }); describe("with UTF-16LE encoding", function() { + it("trims to correct byte length", function() { + note.encoding = "utf16le"; + note.alert = "test message"; + note.trim(48); + + expect(note.length()).to.equal(48); + }); + it("correctly empties the string", function() { note.encoding = "utf16le"; note.alert = Buffer([0x3D, 0xD8, 0x03, 0xDE, 0x3D, 0xD8, 0x1E, 0xDE]).toString(note.encoding);