This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'isomorphic-fetch'; | |
import {expect} from 'code'; | |
import {getFruits} from '../../src/fruits-repository-2016'; | |
import sinon from 'sinon'; | |
describe('Given the fruits repository', () => { | |
let fetchStub, | |
sandbox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('when getting a collection of fruits', () => { | |
it('should call fetch', async() => { | |
const expectedEndPoint = '/fruits'; | |
const json = sandbox.stub(); | |
fetchStub.returns(Promise.resolve({json})); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('when getting a collection of fruits', () => { | |
describe('and is successful', () => { | |
it('should return an array of fruits', () => { | |
const expectedFruits = [ | |
'apple', | |
'banana', | |
'pears' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'isomorphic-fetch'; | |
import {expect} from 'code'; | |
import {getFruits} from '../../src/fruits-repository'; | |
import sinon from 'sinon'; | |
describe('Given the fruits repository', () => { | |
let fetchStub, | |
sandbox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('when getting a collection of fruits', () => { | |
describe('and is successful', () => { | |
it('should return an array of fruits', async() => { | |
const expectedFruits = [ | |
'apple', | |
'banana', | |
'pears' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('when getting a collection of fruits', () => { | |
describe('and is unsuccessful', () => { | |
it('should return an error object', async() => { | |
const expectedErrorObject = { | |
message: 'No fruits found.' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('when getting a collection of fruits', () => { | |
describe('and is unsuccessful', () => { | |
it('should return an error object', () => { | |
const expectedErrorObject = { | |
message: 'No fruits found.' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"address": { | |
"city": "Chicago", | |
"country": "USA", | |
"state": "IL", | |
"street": "Michigan Avenue", | |
"zip": "60611" | |
}, | |
"birthdate": { | |
"day": 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe.only('Given some `foo` variable', () => { | |
let foo; | |
beforeEach(() => { | |
foo = 2; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {mount} from 'enzyme'; | |
import LockScreen from './LockScreen'; | |
describe('LockScreen', () => { | |
let lockScreenEl, | |
testProps; | |
beforeEach('Component setup', () => { |