Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] __type__ seems to not be available anymore #785

Closed
theobouge-ovh opened this issue Apr 9, 2024 · 2 comments
Closed

[bug] __type__ seems to not be available anymore #785

theobouge-ovh opened this issue Apr 9, 2024 · 2 comments

Comments

@theobouge-ovh
Copy link

theobouge-ovh commented Apr 9, 2024

Hello 👋 ,

I think the __type__ value isn't available anymore at least for json object

Here is a test case forked from ShouldJSONContain.yml

name: Assertions testsuite
testcases:
  - name: test assertion ShouldJSONContain
    steps:
      - script: |
          echo '[
            {
              "a" : 1,
              "b" : 2,
              "c" : {
                "x":1,
                "y":2
              }
            },
            {
              "bar": "baz"
            }
          ]'
        assertions:
          - result.systemoutjson ShouldJSONContain ' { "c":{ "y" :2 , "x" :1 }, "b" :2 , "a" :1 } '
          - result.systemoutjson ShouldJSONContain ' { "bar":"baz" } '
          - result.systemoutjson.__type__ ShouldEqual Map

here will be the error message

$ $HOME/go/1.22.1/bin/venom-v1.2.0 version
Version venom: v1.2.0
$ $HOME/go/1.22.1/bin/venom-v1.2.0 run ./test.yaml
	  [trac] writing venom.0.log
 • Assertions testsuite (./test.yaml)
 	• test-assertion-ShouldJSONContain FAIL
 		• exec
 		  Testcase "test assertion ShouldJSONContain", step #0-0: Assertion "result.systemoutjson.__type__ ShouldEqual Map" failed. expected: Map  got: <nil> (test.yaml:22)
final status: FAIL

here is the same test with venom 1.1.0

$ $HOME/go/1.22.1/bin/venom-v1.1.0 version
Version venom: v1.1.0
$ $HOME/go/1.22.1/bin/venom-v1.1.0 run ./test.yaml
	  [trac] writing venom.2.log
 • Assertions testsuite (./test.yaml)
 	• test-assertion-ShouldJSONContain FAIL
[ShouldJSONContain not supported ]
Testcase "test assertion ShouldJSONContain", step #0-0: Assertion "result.systemoutjson.__type__ ShouldEqual Map" failed. expected: Map  got: Array (test.yaml:22) #<--- still broken because i don't know how to use my eyes but at least not nil
final status: FAIL

Thank you

@theobouge-ovh theobouge-ovh changed the title [bug] __type__ isn't available anymore [bug] __type__ seems to not be available anymore Apr 9, 2024
@floatovh
Copy link

Hello,

Faced the same "issue".

From version 1.2.0 the default VENOM_PRESERVE_CASE is set to ON, as explained here: #570

You should either update the code and uppercase the first letter: "Type" and also "Len".
For example:

- result.bodyjson.__Type__ ShouldEqual Array

Or set the environment variable VENOM_PRESERVE_CASE to OFF.

@theobouge-ovh
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants