(t *testing.T)
| 723 | } |
| 724 | |
| 725 | func 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 | |
| 771 | func TestObject_ContainsValue(t *testing.T) { |
| 772 | t.Run("basic", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…