Skip to content

Commit

Permalink
test: refactor test to spy on Object.entries
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoCardoso committed Nov 28, 2022
1 parent adac1e9 commit 3572b6f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/charts/test/private-api.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, oneEvent } from '@vaadin/testing-helpers';
import sinon from 'sinon';
import '../vaadin-chart.js';
import { inflateFunctions } from '../src/helpers.js';

Expand Down Expand Up @@ -34,9 +35,16 @@ describe('vaadin-chart private API', () => {
});

it('should not try to inflate if a non-object value is passed', () => {
const spy = sinon.spy(Object, 'entries');
inflateFunctions(1);
expect(spy.callCount).to.be.equal(0);
inflateFunctions(null);
inflateFunctions([1]);
expect(spy.callCount).to.be.equal(0);
const arr = [1, 'a'];
inflateFunctions(arr);
expect(spy.callCount).to.be.equal(0);
inflateFunctions({});
expect(spy.callCount).to.be.equal(1);
});
});

Expand Down

0 comments on commit 3572b6f

Please sign in to comment.