Created
October 14, 2016 21:25
-
-
Save johnsheehan/32c68d520a5d7dee1dff3031531da630 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The JSON Schema that we place into the Initial Script | |
// section of the Runscope API test. | |
var rosterResponse = { | |
"definitions": { | |
"player": { | |
"id": "player", | |
"type": "object", | |
"required": ["player_number","guid","name"], | |
"properties": { | |
"player_number": { "type": "integer" }, | |
"guid": { "type": "string" }, | |
"name": { "type": "string" } | |
} | |
} | |
}, | |
"title": "roster schema v1", | |
"type": "object", | |
"required": ["roster"], | |
"properties": { | |
"roster": { | |
"type": "array", | |
"items": { "$ref": "#/definitions/player" } | |
} | |
} | |
}; | |
variables.set("rosterResponse",rosterResponse); | |
// The JavaScript assertion that picks up the rosterResponse | |
// global variable from above, and the Chai-JSON assertion.. | |
// This we paste into the Scripts section of the request | |
// step. | |
var rosterResponse = variables.get("rosterResponse"); | |
var data = JSON.parse(response.body); | |
assert.jsonSchema(data, rosterResponse); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment