O'Reilly logo

Practical Test-Driven Development using C# 7 by Clayton Hunt, John Callaway

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Get Speaker reducer

To handle the actions related to getting a speaker, we must create two reducers. The first reducer is extremely similar to the reducer we made for the get speakers actions. The second is going to need to be slightly different and is for handling the error case.

Let's begin with the simplest of the two and create the speaker reducer.

describe('Speaker Reducer', () => {     it('exists', () => {       expect(speakerReducer).to.exist;     }); });

Our typical existence test is easily passed.

export function speakerReducer() { }

The next test ensures that the reducer updates state properly, and will close out the tests needed for this reducer.

it('gets a speaker', () => {   // arrange const initialState = { id: '', firstName: '', lastName: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required