Skip to content

Commit 775c84e

Browse files
TrottMylesBorins
authored andcommitted
test: add test-debug-protocol-execute
Add test for `Protocol` object in `_debugger` module. This test covers some edge cases that fill some coverage gaps in our testing (such as the "Unknown state" error). PR-URL: #8454 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a3d0802 commit 775c84e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('assert');
5+
const debug = require('_debugger');
6+
7+
const protocol = new debug.Protocol();
8+
9+
assert.strictEqual(protocol.state, 'headers');
10+
11+
protocol.execute('Content-Length: 10\r\n\r\nfhqwhgads');
12+
13+
assert.strictEqual(protocol.state, 'body');
14+
assert.strictEqual(protocol.res.body, undefined);
15+
16+
protocol.state = 'sterrance';
17+
assert.throws(
18+
() => { protocol.execute('grumblecakes'); },
19+
/^Error: Unknown state$/
20+
);

0 commit comments

Comments
 (0)