Skip to content

Commit

Permalink
Merge 90320dc into 7499697
Browse files Browse the repository at this point in the history
  • Loading branch information
bpytlik committed Jul 14, 2015
2 parents 7499697 + 90320dc commit 6fdd641
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/add-tests.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ addTests = (raml, tests, parent, callback) ->

# Update test.response
test.response.status = status
test.response.schema = []
if (raml.schemas)
test.response.schema = raml.schemas
test.response.schema = null
if (res?.body?['application/json']?.schema)
test.response.schema.push parseSchema res.body['application/json'].schema
test.response.schema = parseSchema res.body['application/json'].schema

callback()
, (err) ->
Expand Down
9 changes: 4 additions & 5 deletions test/unit/add-tests-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe '#addTests', ->
res = tests[0].response

assert.equal res.status, 200
schema = res.schema[0]
schema = res.schema
assert.equal schema.items.properties.type.type, 'string'
assert.equal schema.items.properties.name.type, 'string'
assert.isNull res.headers
Expand Down Expand Up @@ -102,7 +102,7 @@ describe '#addTests', ->
res = tests[1].response

assert.equal res.status, 201
schema = res.schema[0]
schema = res.schema
assert.equal schema.properties.type.type, 'string'
assert.equal schema.properties.name.type, 'string'
assert.isNull res.headers
Expand Down Expand Up @@ -147,7 +147,7 @@ describe '#addTests', ->
res = tests[0].response

assert.equal res.status, 200
assert.lengthOf res.schema, 3
assert.equal res.schema?.properties?.chick?.type, "string"
assert.isNull res.headers
assert.isNull res.body

Expand Down Expand Up @@ -190,8 +190,7 @@ describe '#addTests', ->
res = tests[0].response

assert.equal res.status, 200
# console.log res.schema
assert.lengthOf res.schema, 3
assert.equal res.schema?.properties?.type["$ref"], "type2"
assert.isNull res.headers
assert.isNull res.body

Expand Down

0 comments on commit 6fdd641

Please sign in to comment.