Browse Source

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: https://github.com/nodejs/node/pull/8454
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
v7.x
Rich Trott 8 years ago
parent
commit
5282f0be17
  1. 20
      test/parallel/test-debug-protocol-execute.js

20
test/parallel/test-debug-protocol-execute.js

@ -0,0 +1,20 @@
'use strict';
require('../common');
const assert = require('assert');
const debug = require('_debugger');
const protocol = new debug.Protocol();
assert.strictEqual(protocol.state, 'headers');
protocol.execute('Content-Length: 10\r\n\r\nfhqwhgads');
assert.strictEqual(protocol.state, 'body');
assert.strictEqual(protocol.res.body, undefined);
protocol.state = 'sterrance';
assert.throws(
() => { protocol.execute('grumblecakes'); },
/^Error: Unknown state$/
);
Loading…
Cancel
Save