Integration tests

This commit is contained in:
Michal Horejsek
2021-01-12 10:04:15 +01:00
parent 6c96643d12
commit 21d8ef649f
5 changed files with 103 additions and 27 deletions

View File

@ -70,9 +70,12 @@ func (ctl *Controller) PrintCalls() {
func (ctl *Controller) WasCalled(method, path string, expectedRequest []byte) bool {
for _, call := range ctl.calls {
if string(call.method) != method && call.path != path {
if string(call.method) != method || call.path != path {
continue
}
if string(expectedRequest) == "" {
return true
}
diff, _ := jsondiff.Compare(call.request, expectedRequest, &jsondiff.Options{})
isSuperset := diff == jsondiff.FullMatch || diff == jsondiff.SupersetMatch
if isSuperset {