Comments (4)
I think you can do something like:
expectJSONType([{
district_id: function(val) {
expect(val).toBeGreaterThan(0)
},
district_name: String
}])
As for the response being empty, you would just do a separate test that you know will produce an empty array, and do:
expectJSON([])
from frisby.
Beat me to it :)
Yes, you can do custom callbacks with your own Jasmine matchers in place of the normal String
, Number
, Boolean
, etc. The only other thing to note is that you may want to return
the result of the custom expectation inside your callback, depending on what error message you want to see.
from frisby.
Passing [] to expectJSON always passes for me as long as it's an array. I'm trying to figure out how to encode into the JSON that I'm specifically expecting ONLY an empty array.
from frisby.
I am having the same issue as @Shplorf . I am using expectJSONLength(0) for now which is working. But it's weird that expectJSON([]) always passes!
from frisby.
Related Issues (20)
- Iterate through multiple get calls. HOT 3
- Could not generate token using frisby v2 HOT 10
- could not run test sequentially HOT 21
- frsiby method call returns _fetch: Promise { <pending> }
- could not run test
- unexpected response when posting request with content type x-www-form-urlencoded HOT 9
- Does not show the line where code is failing. Its always points the frisby code.
- Upgrade Joi dependency to v17 HOT 1
- Missing logo HOT 3
- What's the appropriate way to trigger CI/CD? Using a web server? HOT 1
- Is there a function similar to bodyContains but for headers? HOT 2
- Loop through JSON object in Expect()? HOT 12
- Using query parameters in API calls HOT 1
- PUT Call Double Encoding URL HOT 3
- Remove Joi export and move it from peer dependencies to dependencies
- Latest joi version does not work HOT 3
- Unhandled promise rejection: TypeError: response.textConverted is not a function while using Jasmine with Frisby HOT 1
- Update npm package.
- Socket hang up / ECONNRESET errors with Node.js 20.x HOT 4
- CVE on frisby dependency (joi)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frisby.