Skip to content

Commit

Permalink
Covers all line of codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Oct 31, 2022
1 parent 0b1d9ce commit 9ee40a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/JsonEventParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export class JsonEventParser extends Transform {
return key;
}
}
/* istanbul ignore next */
throw new Error(`Not supported token code ${code}`);
}

Expand Down Expand Up @@ -445,7 +444,6 @@ export class JsonEventParser extends Transform {

private popFromStack(token: number): void {
const parent = this.stack.pop();
/* istanbul ignore next */
if (parent === undefined) {
throw new Error('The JSON tree too many object or array closings');
}
Expand Down
11 changes: 11 additions & 0 deletions test/internals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { JsonEventParser } from '../lib/JsonEventParser';

describe('JsonEventParser', () => {
it('tokenName and invalid key', () => {
expect(() => (<any>JsonEventParser).tokenName(999)).toThrow(Error);
});

it('popFromStack on empty stack', () => {
expect(() => (<any> new JsonEventParser()).popFromStack(0)).toThrow(Error);
});
});

0 comments on commit 9ee40a2

Please sign in to comment.