more unit tests
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ let resources = {
|
|||||||
try {
|
try {
|
||||||
resources = require('../resources.json');
|
resources = require('../resources.json');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('fa-diagrams: SVG resources could not be loaded', err);
|
console.error('fa-diagrams: SVG resources could not be loaded: ' + err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-1
@@ -1,9 +1,27 @@
|
|||||||
/* jshint -W117 */
|
/* jshint -W117 */
|
||||||
const rendering = require('../src/rendering');
|
let rendering = require('../src/rendering');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
const solidCirclePath = 'M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z';
|
const solidCirclePath = 'M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z';
|
||||||
const regularCirclePath = 'M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z';
|
const regularCirclePath = 'M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z';
|
||||||
|
|
||||||
|
describe('resources fail', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
fs.renameSync('resources.json', 'resources.tmp.json');
|
||||||
|
jest.resetModules();
|
||||||
|
rendering = require('../src/rendering');
|
||||||
|
});
|
||||||
|
afterAll(() => {
|
||||||
|
fs.renameSync('resources.tmp.json', 'resources.json');
|
||||||
|
jest.resetModules();
|
||||||
|
rendering = require('../src/rendering');
|
||||||
|
});
|
||||||
|
test('getIcon no resources', () => {
|
||||||
|
const res = rendering().getIcon('regular circle');
|
||||||
|
expect(res).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('getIcon', () => {
|
describe('getIcon', () => {
|
||||||
test('no name', () => {
|
test('no name', () => {
|
||||||
const res = rendering().getIcon(undefined);
|
const res = rendering().getIcon(undefined);
|
||||||
|
|||||||
Reference in New Issue
Block a user