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

Assert with floating point number fails #283

Closed
bohni opened this issue May 13, 2024 · 1 comment
Closed

Assert with floating point number fails #283

bohni opened this issue May 13, 2024 · 1 comment

Comments

@bohni
Copy link

bohni commented May 13, 2024

POST https://httpbin.org/post
Content-Type: application/json

{
  "someFields": [
    {
      "confidence": 1
    },
    {
      "confidence": 0.934
    }
  ]
}

?? js response.parsedBody.json.someFields[0].confidence == 1
?? js response.parsedBody.json.someFields[1].confidence == 0.934

Assert:

?? js response.parsedBody.signatures[1].confidence == 0.934

This assert fails with message

response.parsedBody.signatures[1].confidence == 0.934 (AssertionError [ERR_ASSERTION]: response.parsedBody.signatures[1].confidence (0.934) == 0 - <path>

AnWeber added a commit to AnWeber/httpyac that referenced this issue May 13, 2024
@AnWeber
Copy link
Owner

AnWeber commented May 13, 2024

I have to convert the string into a number before the comparison, unfortunately I used parseInt there. With the next release, parseFloat will now be used

@AnWeber AnWeber closed this as completed May 13, 2024
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