-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(logs): fix log color utils (#4909)
* fix(logs): fix log color utils
- Loading branch information
1 parent
c67a14e
commit 70c47ec
Showing
5 changed files
with
79 additions
and
13 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
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,50 @@ | ||
import {colorForSeverity, getBrighterColor} from 'src/logs/utils/colors' | ||
import {SeverityColorValues} from 'src/logs/constants' | ||
|
||
describe('Logs.Utils.colors', () => { | ||
describe('.colorForSeverity', () => { | ||
it('can get a color for just a color name', () => { | ||
const actual = colorForSeverity('comet', null) | ||
|
||
expect(actual).toEqual(SeverityColorValues.comet) | ||
}) | ||
|
||
it('can get a color for just a severity level', () => { | ||
const actual = colorForSeverity(null, 'emerg') | ||
|
||
expect(actual).toEqual(SeverityColorValues.ruby) | ||
}) | ||
|
||
it('can return a default color value', () => { | ||
const actual = colorForSeverity(null, null) | ||
|
||
expect(actual).toEqual(SeverityColorValues.star) | ||
}) | ||
}) | ||
|
||
describe('.getBrighterColor', () => { | ||
it('can handle an unrecognized hex color value', () => { | ||
const actual = getBrighterColor(0.5, 'beep') | ||
|
||
expect(actual).toEqual(SeverityColorValues.star) | ||
}) | ||
|
||
it('can handle a null color', () => { | ||
const actual = getBrighterColor(0.5, null) | ||
|
||
expect(actual).toEqual(SeverityColorValues.star) | ||
}) | ||
|
||
it('can handle an empty color value', () => { | ||
const actual = getBrighterColor(0.5, null) | ||
|
||
expect(actual).toEqual(SeverityColorValues.star) | ||
}) | ||
|
||
it('can handle a color name', () => { | ||
const actual = getBrighterColor(0.5, 'blue') | ||
|
||
expect(actual).toEqual('#0000ff') | ||
}) | ||
}) | ||
}) |