-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add tests for new util functions
- add tests for rgbDecimalToHex - add tests for decimalToHex
- Loading branch information
1 parent
749c686
commit ec2e775
Showing
1 changed file
with
21 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Utils from '../utils' | ||
|
||
describe('Utils rgbDecimalToHex', () => { | ||
it('should return normal hex colors', (done) => { | ||
let res_black = Utils.rgbDecimalToHex(0,0,0) | ||
expect(res_black).to.equal('#000000') | ||
let res_white = Utils.rgbDecimalToHex(255,255,255) | ||
expect(res_white).to.equal('#ffffff') | ||
done() | ||
}) | ||
}) | ||
|
||
describe('Utils decimalToHex', () => { | ||
it('should convert decimals to 2 digit hex values', (done) => { | ||
expect( Utils.decimalToHex(15)).to.equal('0f') | ||
expect( Utils.decimalToHex(0)).to.equal('00') | ||
expect( Utils.decimalToHex(16)).to.equal('10') | ||
expect( Utils.decimalToHex(255)).to.equal('ff') | ||
done() | ||
}) | ||
}) |