Skip to content

Commit 1e49721

Browse files
test: use valid ALPN wire-format fixtures
1 parent 9a83a24 commit 1e49721

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

test/parallel/test-tls-basic-validations.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,19 @@ assert.throws(() => tls.createServer({ ticketKeys: Buffer.alloc(0) }), {
8181
});
8282

8383
{
84-
const buffer = Buffer.from('abcd');
84+
const buffer = Buffer.from([3, 0x61, 0x62, 0x63]);
8585
const out = {};
8686
tls.convertALPNProtocols(buffer, out);
87-
out.ALPNProtocols.write('efgh');
88-
assert(buffer.equals(Buffer.from('abcd')));
89-
assert(out.ALPNProtocols.equals(Buffer.from('efgh')));
87+
out.ALPNProtocols.write('def', 1);
88+
assert(buffer.equals(Buffer.from([3, 0x61, 0x62, 0x63])));
89+
assert(out.ALPNProtocols.equals(Buffer.from([3, 0x64, 0x65, 0x66])));
9090
}
9191

9292
{
93-
const arrayBufferViewStr = 'abcd';
94-
const inputBuffer = Buffer.from(arrayBufferViewStr.repeat(8), 'utf8');
93+
const inputBuffer = Buffer.concat([
94+
Buffer.from([31]),
95+
Buffer.alloc(31, 0x61),
96+
]);
9597
for (const expectView of common.getArrayBufferViews(inputBuffer)) {
9698
const out = {};
9799
const expected = Buffer.from(expectView.buffer.slice(),

0 commit comments

Comments
 (0)