Skip to content

Commit

Permalink
added trim test
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Jun 2, 2021
1 parent 5426eb2 commit c3e6131
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/headers_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,18 @@ Deno.test("headers - handles no space", () => {
assert(m.headers);
assertEquals(m.headers.get("A"), "A");
});

Deno.test("headers - trims values", () => {
const te = new TextEncoder();
const d = new TestDispatcher();
const p = new Parser(d);
p.parse(
te.encode(`HMSG SUBJECT 1 REPLY 23 23\r\nNATS/1.0\r\nA: A \r\n\r\n\r\n`),
);
assertEquals(d.errs.length, 0);
assertEquals(d.msgs.length, 1);
const e = d.msgs[0];
const m = new MsgImpl(e.msg!, e.data!, {} as Publisher);
assert(m.headers);
assertEquals(m.headers.get("A"), "A");
});

0 comments on commit c3e6131

Please sign in to comment.