diff --git a/src/ifElse.test.js b/src/ifElse.test.js index 95985e0..6ba1b3a 100644 --- a/src/ifElse.test.js +++ b/src/ifElse.test.js @@ -1,11 +1,29 @@ 'use strict'; describe('ifElse', () => { - // const { ifElse } = require('./ifElse'); + const { ifElse } = require('./ifElse'); - it('should ', () => { + it('should return first if condition is true', () => { + const condition = jest.fn(() => true); + const first = jest.fn(); + const second = jest.fn(); + ifElse(condition, first, second); + + expect(condition).toHaveBeenCalled(); + expect(first).toHaveBeenCalled(); + expect(second).not.toHaveBeenCalled(); }); - // write tests here + it('should return first if condition is true', () => { + const condition = jest.fn(() => false); + const first = jest.fn(); + const second = jest.fn(); + + ifElse(condition, first, second); + + expect(condition).toHaveBeenCalled(); + expect(first).not.toHaveBeenCalled(); + expect(second).toHaveBeenCalled(); + }); });