"intVal": 1234, "floatVal": 1234.1234, "boolVal": true, "arrayVal": []interface{}{ "asdf", "fdsa", }, "mapVal": map[string]interface{}{ "key": "value", }, } Describe("ArrayVal", func() { It("returns an array from the endpoint, when provided the right key", func() { expected := []interface{}{"asdf", "fdsa"} got, err := endpoint.ArrayValue("arrayVal") Expect(got).Should(BeEquivalentTo(expected)) Expect(err).ShouldNot(HaveOccurred()) }) It("errors out when not pointed at an array", func() { got, err := endpoint.ArrayValue("stringVal") Expect(got).Should(BeNil()) Expect(err).Should(HaveOccurred()) Expect(err).Should(MatchError(plugin.EndpointDataTypeMismatchError{Key: "stringVal", DesiredType: "array"})) }) It("errors out when pointed at a nonexistant key", func() { got, err := endpoint.ArrayValue("doesnotexist") Expect(got).Should(BeNil()) Expect(err).Should(HaveOccurred()) Expect(err).Should(MatchError(plugin.EndpointMissingRequiredDataError{Key: "doesnotexist"})) })