This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dom Harrington
committed
Nov 2, 2017
1 parent
2663828
commit 46b0264
Showing
4 changed files
with
33 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
packages/api-explorer-ui/__tests__/ResponseSchema.test.jsx
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,32 @@ | ||
const React = require('react'); | ||
const { shallow } = require('enzyme'); | ||
|
||
const ResponseSchema = require('../src/ResponseSchema'); | ||
const Oas = require('../src/lib/Oas'); | ||
const petstore = require('./fixtures/petstore/oas.json'); | ||
|
||
const oas = new Oas(petstore); | ||
|
||
const props = { | ||
operation: oas.operation('/pet/{petId}', 'get'), | ||
}; | ||
|
||
describe('selectedStatus', () => { | ||
test('selectedStatus should change state of selectedStatus', () => { | ||
const responseSchema = shallow(<ResponseSchema {...props} />); | ||
|
||
expect(responseSchema.state('selectedStatus')).toBe('200'); | ||
|
||
responseSchema.instance().selectedStatus('400'); | ||
|
||
expect(responseSchema.state('selectedStatus')).toBe('400'); | ||
}); | ||
}); | ||
|
||
describe('ResponseSchema', () => { | ||
test('should display response schema', () => { | ||
const responseSchema = shallow(<ResponseSchema {...props} />); | ||
|
||
expect(responseSchema.find('p.desc').text()).toBe(props.operation.responses['200'].description); | ||
}); | ||
}); |
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
File renamed without changes.