forked from gulpjs/theming-log
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
8 changed files
with
155 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
|
||
/* eslint brace-style: off */ | ||
|
||
var chai = require('chai'); | ||
var expect = chai.expect; | ||
var themingLog = require('..'); | ||
|
||
var format = themingLog.format; | ||
|
||
describe('format', function() { | ||
|
||
describe('Format text with decorations by themes', function() { | ||
|
||
var themes = { | ||
red: function(v) { return 'Red:[' + v + ']'; }, | ||
blue: function(v) { return 'Blue:[' + v + ']'; }, | ||
yellow: function(v) { return 'Yellow:[' + v + ']'; }, | ||
bold: function(v) { return 'Bold:[' + v + ']'; }, | ||
italic: function(v) { return 'Italic:[' + v + ']'; }, | ||
grinning: function() { return ':smile:'; }, | ||
|
||
INFO: null, | ||
WARNING: 'yellow', | ||
ERROR: 'red', | ||
HIGHLIGHT: 'bold', | ||
|
||
TypeError: 'error', | ||
AppError: function(v) { return 'Magenta:[' + v + ']'; }, | ||
}; | ||
|
||
it('Should format no themed text', function() { | ||
var out = format(themes, 'This text contains no theme'); | ||
expect(out).to.equal('This text contains no theme'); | ||
}); | ||
|
||
it('Should format text using theme', function() { | ||
var out = format(themes, | ||
'This {bold: text} contains {red: themed { italic : message }}.'); | ||
expect(out).to.equal('This Bold:[text] contains Red:[themed ' + | ||
'Italic:[message]].'); | ||
}); | ||
|
||
it('Should replace arg-themes to argument values', function() { | ||
var out = format(themes, | ||
'This text has arg-theme: {2} and {1: One}', 'Arg1', 'Arg2'); | ||
expect(out).to.equal('This text has arg-theme: Arg2 and Arg1'); | ||
}); | ||
}); | ||
|
||
}); |
File renamed without changes.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.