blippar / aragorn

Regression tests made easy
Apache License 2.0
7 stars 1 forks source link

jsonValues validation on JSON Array #2

Closed 0rax closed 6 years ago

0rax commented 6 years ago

When trying to validate values from a document returned as a JSON Document ([]interface{}), aragorn panic with the following error:

panic: interface conversion: interface {} is []interface {}, not map[string]interface {}
goroutine 1 [running]:
github.com/blippar/aragorn/vendor/github.com/jmoiron/jsonq.NewQuery(...)
    /Users/orax/Projects/Go/src/github.com/blippar/aragorn/vendor/github.com/jmoiron/jsonq/jsonq.go:85
github.com/blippar/aragorn/testsuite/httpexpect.(*Response).ContainsJSONValues(0xc42032c190, 0xc4201cc930)
    /Users/orax/Projects/Go/src/github.com/blippar/aragorn/testsuite/httpexpect/response.go:103 +0x43b
github.com/blippar/aragorn/testsuite/httpexpect.(*Suite).runTest(0xc4202e8540, 0xc4201fa780, 0x1971168, 0xc4201fb4a0, 0x0, 0x0)
    /Users/orax/Projects/Go/src/github.com/blippar/aragorn/testsuite/httpexpect/httpexpect.go:123 +0x4c2
github.com/blippar/aragorn/testsuite/httpexpect.(*Suite).runTestWithRetry(0xc4202e8540, 0xc4201fa780, 0x1971168, 0xc4201fb4a0)

This issue comes from the jsonq library itself (see jsonq.go:85), it seems that this is a know issue (see https://github.com/jmoiron/jsonq/issues/12 & https://github.com/jmoiron/jsonq/issues/5) which as not yet been fixed.

post-l commented 6 years ago

Fixed by #3