Skip to content

Commit

Permalink
little edits
Browse files Browse the repository at this point in the history
  • Loading branch information
quii committed Jun 8, 2018
1 parent 73cadd2 commit e3b8f61
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions io.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ If we go back to `FileSystemStore.go` we have

It was pragmatic to ignore that at the time as we already had failing tests. If we had tried to tackle it at the same time we would be juggling two things at once.

If we get an error we'll want to inform the user there was some kind of problem by returning a `500` status code and some kind of message. We'll also want to log it, but we'll get onto that in a later chapter.
If we get an error we'll want to inform the user there was a problem by returning a `500` status code and a message. We'll also want to log it, but we'll get onto that in a later chapter.

Let's try and return the error in our function

Expand Down Expand Up @@ -967,7 +967,7 @@ t.Run("return an error when league cannot be read", func(t *testing.T) {
})
```

If we run this test it actually passes. To check it works how we'd hope, change `GetLeague` to return `nil` for the error in all scenarios and check the test output is what you expect. It's very important you check tests fail how you expect them if you didn't follow the strict TDD cycle.
If we run this test it actually passes. To check it fails how we'd hope, change `GetLeague` to return `nil` for the error in all scenarios and check the test output is what you expect. It's very important you check tests fail how you expect them if you didn't follow the strict TDD cycle.

## Remaining technical debt

Expand Down Expand Up @@ -998,6 +998,16 @@ Just follow these steps for each method carefully, trying to re-run the compiler

tl;dr - Make the change you want and use the compiler to help you get back to working code.

Once you have finished this your `PlayerStore` should look like this

```go
type PlayerStore interface {
GetPlayerScore(name string) (int, error)
RecordWin(name string) error
GetLeague() (League, error)
}
```

If you get stuck, start over. If you get really stuck, [have a look at the current state of the code here](https://github.com/quii/learn-go-with-tests/tree/master/io/v7)

### Integration test woes
Expand Down

0 comments on commit e3b8f61

Please sign in to comment.