mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-11 01:02:45 +00:00
feat: tests
This commit is contained in:
@@ -13,15 +13,12 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {expect} from 'chai';
|
||||
import {suite, test} from '@testdeck/mocha';
|
||||
import {AddLogLevel} from '../../src/transformations/add-log-level.js';
|
||||
import {AddLogLevel} from '../../src/index.js';
|
||||
|
||||
@suite()
|
||||
export class AddLogLevelSpec {
|
||||
@test
|
||||
transform() {
|
||||
describe('add log level', function () {
|
||||
it('should transform', function () {
|
||||
const transformation = new AddLogLevel();
|
||||
|
||||
expect(transformation.transform('ERROR', 'Foobar')).to.be.equal('[ERROR] Foobar');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {expect} from 'chai';
|
||||
import {suite, test} from '@testdeck/mocha';
|
||||
import {Colorize} from '../../src/transformations/colorize.js';
|
||||
import {Colorize} from '../../src/index.js';
|
||||
import chalk from 'chalk';
|
||||
|
||||
@suite()
|
||||
export class ColorizeSpec {
|
||||
@test
|
||||
transform() {
|
||||
chalk.level = 2;
|
||||
|
||||
describe('colorize', function () {
|
||||
it('should transform', function () {
|
||||
const transformation = new Colorize();
|
||||
|
||||
expect(transformation.transform('ERROR', 'Foobar')).to.be.equal(
|
||||
'\u001b[1m\u001b[31mFoobar\u001b[39m\u001b[22m',
|
||||
'\u001B[1m\u001B[31mFoobar\u001B[39m\u001B[22m',
|
||||
);
|
||||
expect(transformation.transform('LOG', 'Foobar')).to.be.equal('\u001b[37mFoobar\u001b[39m');
|
||||
}
|
||||
}
|
||||
expect(transformation.transform('LOG', 'Foobar')).to.be.equal('\u001B[37mFoobar\u001B[39m');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,15 +13,12 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {expect} from 'chai';
|
||||
import {suite, test} from '@testdeck/mocha';
|
||||
import {Timestamp} from '../../src/transformations/timestamp.js';
|
||||
import {Timestamp} from '../../src/index.js';
|
||||
|
||||
@suite()
|
||||
export class TimeStampSpec {
|
||||
@test
|
||||
default() {
|
||||
describe('timestamp', function () {
|
||||
it('should contain Z', function () {
|
||||
const transformation = new Timestamp();
|
||||
|
||||
expect(transformation.transform('ERROR', 'Foobar')).to.be.contain(`Z`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user