Comments (9)
Could you provide the data structure you are validating
from chakram.
This is the schema:
var expectSchema = {
"type":"object",
properties: {
created_at: {type: 'string'},
created_by: {type: 'number'},
description: {type: 'string'}
},
required: [
'description',
'created_by'
]
};
JSON Response to validate:
{ collaborators: null,
created_at: '2016-05-11T15:29:27Z',
created_by: '************',
description: 'Source edited by Test',
name: 'abc',
updated_at: '2016-05-11T15:29:27Z',
updated_by: '**********' }
from chakram.
@syed12304 Looking at your schema, you've stated that created_by is a number, but in the object you're passing, created_by is a string. Failing JSON schema validation in this case is expected behaviour, therefore I will be closing this issue. If you think this demonstrates a problem/shortcoming with chakram, please feel free to reopen.
from chakram.
changing the created_by schema as string also returns the same error...
from chakram.
what error are you getting?
from chakram.
error: Invalid type: undefined (expected object).
data path: .
schema path: /type.
........................pm ERR! Test failed. See above for more details.
from chakram.
Could you please advise how this issue was resolved?
Below us what I am getting --
Schema = {
"type": "object",
"required": [
"name",
"place"
],
"properties": {
"name": {
"type": "string"
},
"place": {
"type": "string"
}
}
}
Data = {
"name": "HELLO",
"place": "WORLD"
}
AssertionError: expected body to match JSON schema {
"type": "object",
"required": [
"name",
"place"
],
"properties": {
"name": {
"type": "string"
},
"place": {
"type": "string"
}
}
}.
error: Invalid type: undefined (expected object).
data path: .
schema path: /type.
at simpleCall.js:28:35
at _fulfilled (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:816:13)
at xxxxx\chakram-testing\node_modules\q\q.js:624:44
at runSingle (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:137:13)
at flush (C:\LWC_chakram\chakram-testing\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
from chakram.
Did anyone get this issue resolved?
from chakram.
If you get undefined, most likely your response object is empty.
Maybe you get a 401 (Unauthorized) response with an empty (so undefined) body.
from chakram.
Related Issues (20)
- Jasmine support for chakram HOT 1
- Asserting API with dot (.) on field name
- I want to get status code HOT 1
- Error getting the example to work HOT 1
- Body in request
- Need help on a test for demo HOT 3
- JavaScript heap out of memory
- mocha "before all" hook stopped working HOT 1
- Successful retries don't let test pass
- Not able to pass on the certificates using chakram library.
- Error: self signed certificate
- send sessio id and xsrf token to chakram post api
- No files found
- For chakram.patch(url,data,params), it seems that data is required HOT 1
- 404 Not found stringify-clone@^1.0.0 HOT 1
- rt to es6
- Unable to validate JSON Schema - error: Invalid type: undefined (expected object)
- Handle response as buffer
- Documentation for 'comprise'
- Request to keep this great project active HOT 1
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 chakram.