Skip to content

Commit

Permalink
Favor expect.not.toHaveBeenCalled.
Browse files Browse the repository at this point in the history
Change-Id: I7009ff69bfca5ef8a38bcdff73a16a02cfa205b1
  • Loading branch information
TheModMaker committed Jun 26, 2019
1 parent e2ba179 commit b235ca4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ module.exports = {
'[callee.object.property.name=calls]',
'message': 'Use expect.toHaveBeenCalledTimes',
},
{
'selector':
'CallExpression[callee.property.name=toHaveBeenCalledTimes] >' +
'Literal[value=0]',
'message': 'Use expect.not.toHaveBeenCalled',
},
...commonNoRestrictedSyntax,
],
},
Expand Down
2 changes: 1 addition & 1 deletion test/dash/dash_parser_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ describe('DashParser Live', () => {

expect(manifest.periods.length).toBe(1);
// Should call filterAllPeriods for parsing the first manifest
expect(filterNewPeriod).toHaveBeenCalledTimes(0);
expect(filterNewPeriod).not.toHaveBeenCalled();
expect(filterAllPeriods).toHaveBeenCalledTimes(1);

fakeNetEngine.setResponseText('dummy://foo', secondManifest);
Expand Down
2 changes: 1 addition & 1 deletion test/media/region_timeline_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('RegionTimeline', () => {
const differentEndTime = createRegion('my-region', 0, 5);

// Make sure we are starting from a blank slate.
expect(onNewRegion).toHaveBeenCalledTimes(0);
expect(onNewRegion).not.toHaveBeenCalled();

// When we add a region, we should get an event.
timeline.addRegion(initialRegion);
Expand Down
2 changes: 1 addition & 1 deletion test/media/streaming_engine_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ describe('StreamingEngine', () => {
runTest();
expect(onError).toHaveBeenCalledTimes(1);
expect(netEngine.attempts).toBe(1);
expect(mediaSourceEngine.endOfStream).toHaveBeenCalledTimes(0);
expect(mediaSourceEngine.endOfStream).not.toHaveBeenCalled();
});

it('does not invoke the callback if the error is handled', () => {
Expand Down

0 comments on commit b235ca4

Please sign in to comment.