Last active
October 18, 2016 12:58
-
-
Save csmith0651/d2f665a81df36086e15bfdbf229f1369 to your computer and use it in GitHub Desktop.
person_test
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
package person_test | |
import ( | |
. "github.com/tapjoy/mocks3fetcher/person" | |
. "github.com/onsi/ginkgo" | |
. "github.com/onsi/gomega" | |
) | |
var _ = Describe("person", func() { | |
goodJson := ` | |
[ | |
{ | |
"Age": 100, | |
"First": "Craig", | |
"Last": "Smith" | |
}, | |
{ | |
"Age": 2, | |
"First": "Eric", | |
"Last": "Smith" | |
} | |
] | |
` | |
Context("ExtractPersonData", func() { | |
badJson := []byte("bad json data") | |
It("malformed JSON generates an error", func() { | |
_, err := ExtractPersonData(badJson) | |
Expect(err).To(HaveOccurred()) | |
}) | |
It("properly formed JSON returns array of Person", func() { | |
data, err := ExtractPersonData([]byte(goodJson)) | |
Expect(err).ToNot(HaveOccurred()) | |
Expect(data).To(HaveLen(2)) | |
Expect(data[1].Last).To(Equal("Smith")) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment