Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added final tests for complete coverage
- Loading branch information
Showing
5 changed files
with
147 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ node_modules/* | |
api/* | ||
coverage/* | ||
.coveralls.yml | ||
npm-debug* |
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
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,59 @@ | ||
import Result from '../src/Result'; | ||
|
||
describe('Result', () => { | ||
describe('.constructor()', () => { | ||
it('should populate properties correctly', () => { | ||
const result = new Result({message:"error message"}, ["result"]); | ||
expect(result._rawError).to.eql({message:"error message"}); | ||
expect(result._rawResults).to.eql(["result"]); | ||
}); | ||
}); | ||
|
||
describe('.getRawError()', () => { | ||
it('should return the proper data', () => { | ||
const result = new Result({message:"error message"}, ["result"]); | ||
expect(result.getRawError()).to.eql({message:"error message"}); | ||
}); | ||
}); | ||
|
||
describe('.getError()', () => { | ||
it('should return the proper data', () => { | ||
const result = new Result({message:"error message"}, ["result"]); | ||
expect(result.getError()).to.eql({message:"error message"}); | ||
}); | ||
}); | ||
|
||
describe('.getHtmlError()', () => { | ||
it('should return the error wrapped in a jquery element', () => { | ||
const result = new Result({message:"error message"}, ["result"]); | ||
const htmlError = result.getHtmlError(); | ||
htmlError[0].constructor.name.should.eql('HTMLDivElement'); | ||
htmlError.attr('class').should.eql('port-error'); | ||
htmlError.html().should.eql('Could not complete query => error message'); | ||
}); | ||
}); | ||
|
||
describe('.getRawResults()', () => { | ||
it('should return the proper data', () => { | ||
const result = new Result({message:"error message"}, ["result"]); | ||
expect(result.getRawResults()).to.eql(["result"]); | ||
}); | ||
}); | ||
|
||
describe('.getResults()', () => { | ||
it('should return the proper data', () => { | ||
const result = new Result({message:"error message"}, ["result"]); | ||
expect(result.getResults()).to.eql(["result"]); | ||
}); | ||
}); | ||
|
||
describe('.getHtmlResults()', () => { | ||
it('should return the error wrapped in a jquery element', () => { | ||
const result = new Result({message:"error message"}, [{"key" : "result>"}]); | ||
const htmlResults = result.getHtmlResults(); | ||
htmlResults[0].constructor.name.should.eql('HTMLDivElement'); | ||
htmlResults.attr('class').should.eql('port-response json'); | ||
htmlResults.html().replace(/\n */g,'').should.eql('{<span class="key">"key":</span> <span class="string">"result>"</span>}<br>'); | ||
}); | ||
}); | ||
}); |