MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestObject_ContainsKey

Function TestObject_ContainsKey

object_test.go:725–769  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

723}
724
725func TestObject_ContainsKey(t *testing.T) {
726 testObj := map[string]interface{}{"foo": 123, "bar": ""}
727
728 cases := []struct {
729 name string
730 object map[string]interface{}
731 key string
732 wantContainsKey chainResult
733 wantNotContainsKey chainResult
734 }{
735 {
736 name: "foo value, correct key value",
737 object: testObj,
738 key: "foo",
739 wantContainsKey: success,
740 wantNotContainsKey: failure,
741 },
742 {
743 name: "bar value, correct key value",
744 object: testObj,
745 key: "bar",
746 wantContainsKey: success,
747 wantNotContainsKey: failure,
748 },
749 {
750 name: "BAR value, wrong key value",
751 object: testObj,
752 key: "BAR",
753 wantContainsKey: failure,
754 wantNotContainsKey: success,
755 },
756 }
757
758 for _, tc := range cases {
759 t.Run(tc.name, func(t *testing.T) {
760 reporter := newMockReporter(t)
761
762 NewObject(reporter, tc.object).ContainsKey(tc.key).
763 chain.assert(t, tc.wantContainsKey)
764
765 NewObject(reporter, tc.object).NotContainsKey(tc.key).
766 chain.assert(t, tc.wantNotContainsKey)
767 })
768 }
769}
770
771func TestObject_ContainsValue(t *testing.T) {
772 t.Run("basic", func(t *testing.T) {

Callers

nothing calls this directly

Calls 5

newMockReporterFunction · 0.85
NewObjectFunction · 0.85
assertMethod · 0.80
ContainsKeyMethod · 0.80
NotContainsKeyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…