Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start of CommandTool specs, test perf boost
- Loading branch information
Showing
3 changed files
with
60 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// jshint expr:true | ||
|
||
"use strict"; | ||
|
||
const CommandTool = source("components/command-tool.es"); | ||
|
||
function render(props = {}) { | ||
return TestUtils.renderIntoDocument( | ||
<CommandTool {...props} /> | ||
); | ||
} | ||
|
||
function searchMany(component) { | ||
return function(tag) { | ||
return TestUtils.scryRenderedDOMComponentsWithTag(component, tag); | ||
}; | ||
} | ||
|
||
function searchOne(component) { | ||
return function(tag) { | ||
return TestUtils.findRenderedDOMComponentWithTag(component, tag); | ||
}; | ||
} | ||
|
||
describe("CommandTool", () => { | ||
let component, findOne, findMany; | ||
|
||
before(() => { | ||
component = render({ | ||
commands: [ "commandA", "commandB", "commandC" ], | ||
endpoint: "/api/endpoint" | ||
}); | ||
|
||
findOne = searchOne(component); | ||
findMany = searchMany(component); | ||
}) | ||
|
||
beforeEach(() => { | ||
component.state = component.getInitialState(); | ||
}); | ||
|
||
it("is a React component", () => { | ||
expect(TestUtils.isElement(<CommandTool />)).to.be.eql(true); | ||
}); | ||
|
||
it("has a default state", () => { | ||
expect(component.state).to.be.eql({ | ||
command: "commandA", | ||
params: [{ key: "", value: "", type: "string" }], | ||
results: [] | ||
}); | ||
}); | ||
}); |
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