Skip to content

Commit

Permalink
Merge pull request #77 from apiaryio/pksunkara/chore
Browse files Browse the repository at this point in the history
chore: Added test for recent change
  • Loading branch information
pksunkara committed Jan 28, 2017
2 parents 584d148 + 2f19c7c commit 390d8da
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 5 deletions.
16 changes: 11 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Metamorphoses Changelog

# 0.13.2
## 0.13.3

### Bug Fixes

- Fixes the format of an empty request in refract adapter when no requests are given.

## 0.13.2

### Enhancements

Expand All @@ -13,14 +19,14 @@
- Fixed HOST url prefix handling in refract adapter
- Fixed a crash in refract adapter when parameters have no example values

# 0.13.1
## 0.13.1

### Bug Fixes

- Fixes Refract adapters `transformError` to handle errors which do not contain
a source map.

# 0.13.0
## 0.13.0

## Breaking

Expand All @@ -30,13 +36,13 @@
Parser](https://github.com/apiaryio/fury-adapter-apiary-blueprint-parser) can
be used in conjunction with the API Elements adapter in Metamorphoses.

# 0.12.3
## 0.12.3

### Bug Fixes

- Fixed the behaviour of resource.parameters in Refract adapter when no action parameters are present

# 0.12.2
## 0.12.2

### BREAKING

Expand Down
65 changes: 65 additions & 0 deletions test/fixtures/refract-parse-result-no-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"element": "parseResult",
"content": [
{
"element": "category",
"meta": {
"classes": [
"api"
],
"title": "API name"
},
"content": [
{
"element": "category",
"meta": {
"classes": [
"resourceGroup"
],
"title": "Users"
},
"content": [
{
"element": "resource",
"meta": {
"title": "Users"
},
"attributes": {
"href": "/users"
},
"content": [
{
"element": "transition",
"meta": {
"title": "List Users"
},
"content": [
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "204"
},
"content": []
}
]
}
]
}
]
}
]
}
]
}
]
}
20 changes: 20 additions & 0 deletions test/refract-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,26 @@ describe('Transformations • Refract', ->
)
)

describe('No request', ->
applicationAst = null

before(->
applicationAst = convertToApplicationAst(
require('./fixtures/refract-parse-result-no-request.json')
)
)

it('Has a request', ->
assert.isObject(applicationAst.sections[0].resources[0].request)
)

it('Has empty name, description and htmlDescription', ->
assert.strictEqual(applicationAst.sections[0].resources[0].request.name, '')
assert.strictEqual(applicationAst.sections[0].resources[0].request.description, '')
assert.strictEqual(applicationAst.sections[0].resources[0].request.htmlDescription, '')
)
)

describe('Empty request', ->
applicationAst = null

Expand Down

0 comments on commit 390d8da

Please sign in to comment.