This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from apiaryio/netmilk/protagonist-update
Updated protagonist to v0.11.0
- Loading branch information
Showing
9 changed files
with
167 additions
and
119 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
convertAstMetadata = (metadata) -> | ||
result = {} | ||
if Array.isArray metadata | ||
for item in metadata | ||
name = item['name'] | ||
delete item['name'] | ||
|
||
result[name] = item | ||
|
||
result | ||
|
||
module.exports = convertAstMetadata |
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
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{assert} = require 'chai' | ||
|
||
convertAstMetadata = require '../../src/convert-ast-metadata' | ||
|
||
describe 'convertAstMetadata()', () -> | ||
metadata = [ | ||
{ | ||
name: 'name' | ||
description: '' | ||
type: '' | ||
required: true | ||
default: '' | ||
example: 'willy' | ||
values: '' | ||
} | ||
, | ||
{ | ||
name: 'limit' | ||
description: '' | ||
type: '' | ||
required: true | ||
default: '' | ||
example: 1 | ||
values: '' | ||
} | ||
] | ||
|
||
data = null | ||
|
||
describe 'its return', () -> | ||
before () -> | ||
data = convertAstMetadata metadata | ||
|
||
it 'should return an object', () -> | ||
assert.isObject data | ||
|
||
it 'should contain keys with names limit and name', () -> | ||
assert.include Object.keys(data), 'limit' | ||
assert.include Object.keys(data), 'name' | ||
|
||
it 'values should not contain "name" key', () -> | ||
for key, values of data | ||
assert.notInclude Object.keys(values), 'name' | ||
|
||
it 'should return empty hash if input is undefined', () -> | ||
assert.deepEqual {}, convertAstMetadata undefined |
Oops, something went wrong.