Skip to content

Instantly share code, notes, and snippets.

View rodoabad's full-sized avatar
😝
Changing the world through JavaScript (and TypeScript)!

Rodo Abad rodoabad

😝
Changing the world through JavaScript (and TypeScript)!
View GitHub Profile
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;
describe('when getting a collection of fruits', () => {
it('should call fetch', async() => {
const expectedEndPoint = '/fruits';
const json = sandbox.stub();
fetchStub.returns(Promise.resolve({json}));
describe('when getting a collection of fruits', () => {
describe('and is successful', () => {
it('should return an array of fruits', () => {
const expectedFruits = [
'apple',
'banana',
'pears'
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;
describe('when getting a collection of fruits', () => {
describe('and is successful', () => {
it('should return an array of fruits', async() => {
const expectedFruits = [
'apple',
'banana',
'pears'
describe('when getting a collection of fruits', () => {
describe('and is unsuccessful', () => {
it('should return an error object', async() => {
const expectedErrorObject = {
message: 'No fruits found.'
};
describe('when getting a collection of fruits', () => {
describe('and is unsuccessful', () => {
it('should return an error object', () => {
const expectedErrorObject = {
message: 'No fruits found.'
};
{
"address": {
"city": "Chicago",
"country": "USA",
"state": "IL",
"street": "Michigan Avenue",
"zip": "60611"
},
"birthdate": {
"day": 1,
describe.only('Given some `foo` variable', () => {
let foo;
beforeEach(() => {
foo = 2;
});
import React from 'react';
import {mount} from 'enzyme';
import LockScreen from './LockScreen';
describe('LockScreen', () => {
let lockScreenEl,
testProps;
beforeEach('Component setup', () => {