Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('It should return module(object)', () => {
- it('Return object', () => {
- expect(typeof createCalculator()).to.equal('object');
- });
- it('Contains add property', () => {
- expect(createCalculator()).to.have.property('add');
- });
- it('Contains subtract property', () => {
- expect(createCalculator()).to.have.property('subtract');
- });
- it('Contains get property', () => {
- expect(createCalculator()).to.have.property('get');
- });
- it('Return a function', () => {
- expect(typeof createCalculator().add).to.equal('function');
- });
- it('Return a function', () => {
- expect(typeof createCalculator().subtract).to.equal('function');
- });
- it('Return a function', () => {
- expect(typeof createCalculator().get).to.equal('function');
- });
- let calc = createCalculator();
- it('Add to parse string number', () => {
- calc.add('1');
- expect(calc.get()).to.equal(1);
- });
- it('Subtract to parse string number', () => {
- calc.subtract('2');
- expect(calc.get()).to.equal(-1);
- });
- it('Add a number', () => {
- calc.add(2);
- expect(calc.get()).to.equal(1);
- });
- it('Subtract a number', () => {
- calc.subtract(2);
- expect(calc.get()).to.equal(-1);
- });
- it('Add a number', () => {
- calc.add(2);
- expect(calc.get()).to.equal(1);
- });
- it('Return the value', () => {
- expect(typeof calc.get()).to.equal('number');
- expect(calc.get()).to.equal(1);
- });
- it('String params to return NaN', () => {
- let calc = createCalculator();
- calc.add('string');
- expect(calc.get()).to.be.NaN;
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement