Skip to content
Snippets Groups Projects
Commit db22eb83 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Move mocha to tdd

parent 7fd48c93
Branches
No related tags found
No related merge requests found
...@@ -5,6 +5,11 @@ module.exports = function(config) { ...@@ -5,6 +5,11 @@ module.exports = function(config) {
config.set({ config.set({
basePath: 'dist', basePath: 'dist',
frameworks: ['mocha'], frameworks: ['mocha'],
client: {
mocha: {
ui: 'tdd',
},
},
files: [ files: [
{pattern: './*.js', included: true, watched: true, served: true, type: 'module'}, {pattern: './*.js', included: true, watched: true, served: true, type: 'module'},
{pattern: './**/*', included: false, watched: true, served: true}, {pattern: './**/*', included: false, watched: true, served: true},
......
import {assert} from 'chai'; import {assert} from 'chai';
import * as i18next from '../i18next.js'; import * as i18next from '../i18next.js';
describe('i18next', () => { suite('i18next', () => {
it('createInstance', () => { test('createInstance', () => {
var inst = i18next.createInstance({de: {}}, 'de', 'en'); var inst = i18next.createInstance({de: {}}, 'de', 'en');
assert.exists(inst); assert.exists(inst);
assert.deepEqual(inst.languages, ['de', 'en']); assert.deepEqual(inst.languages, ['de', 'en']);
}); });
it('translations', () => { test('translations', () => {
var inst = i18next.createInstance({de: {foo: 'bar'}, en: {foo: 'baz', extra: 'quux'}}, 'de', 'en'); var inst = i18next.createInstance({de: {foo: 'bar'}, en: {foo: 'baz', extra: 'quux'}}, 'de', 'en');
assert.deepEqual(inst.languages, ['de', 'en']); assert.deepEqual(inst.languages, ['de', 'en']);
assert.equal( inst.t('foo'), 'bar'); assert.equal( inst.t('foo'), 'bar');
...@@ -24,7 +24,7 @@ describe('i18next', () => { ...@@ -24,7 +24,7 @@ describe('i18next', () => {
assert.equal( inst.t('nope'), 'nope'); assert.equal( inst.t('nope'), 'nope');
}); });
it('date format', () => { test('date format', () => {
var inst = i18next.createInstance({de: {}}, 'de', 'en'); var inst = i18next.createInstance({de: {}}, 'de', 'en');
assert.deepEqual(inst.languages, ['de', 'en']); assert.deepEqual(inst.languages, ['de', 'en']);
...@@ -35,7 +35,7 @@ describe('i18next', () => { ...@@ -35,7 +35,7 @@ describe('i18next', () => {
assert.equal(i18next.dateTimeFormat(inst, date), '12/17/1995'); assert.equal(i18next.dateTimeFormat(inst, date), '12/17/1995');
}); });
it('number format', () => { test('number format', () => {
var inst = i18next.createInstance({de: {}}, 'de', 'en'); var inst = i18next.createInstance({de: {}}, 'de', 'en');
assert.deepEqual(inst.languages, ['de', 'en']); assert.deepEqual(inst.languages, ['de', 'en']);
......
...@@ -5,15 +5,15 @@ import '../vpu-mini-spinner.js'; ...@@ -5,15 +5,15 @@ import '../vpu-mini-spinner.js';
import '../vpu-spinner.js'; import '../vpu-spinner.js';
import '../jsonld.js'; import '../jsonld.js';
describe('utils', () => { suite('utils', () => {
it('base64EncodeUnicode', () => { test('base64EncodeUnicode', () => {
expect(utils.base64EncodeUnicode('')).to.equal(''); expect(utils.base64EncodeUnicode('')).to.equal('');
expect(utils.base64EncodeUnicode('foo')).to.equal('Zm9v'); expect(utils.base64EncodeUnicode('foo')).to.equal('Zm9v');
expect(utils.base64EncodeUnicode('äöü')).to.equal('w6TDtsO8'); expect(utils.base64EncodeUnicode('äöü')).to.equal('w6TDtsO8');
expect(utils.base64EncodeUnicode('😊')).to.equal('8J+Yig=='); expect(utils.base64EncodeUnicode('😊')).to.equal('8J+Yig==');
}); });
it('defineCustomElement', () => { test('defineCustomElement', () => {
class SomeElement extends HTMLElement { class SomeElement extends HTMLElement {
constructor() { constructor() {
super(); super();
...@@ -27,21 +27,21 @@ describe('utils', () => { ...@@ -27,21 +27,21 @@ describe('utils', () => {
expect(node.foo).to.equal(42); expect(node.foo).to.equal(42);
}); });
it('getAPiUrl', () => { test('getAPiUrl', () => {
assert(utils.getAPiUrl().startsWith("http")); assert(utils.getAPiUrl().startsWith("http"));
}); });
it('setting', () => { test('setting', () => {
assert(utils.setting('apiBaseUrl').startsWith("http")); assert(utils.setting('apiBaseUrl').startsWith("http"));
}); });
it('getAssetURL', () => { test('getAssetURL', () => {
utils.initAssetBaseURL(); utils.initAssetBaseURL();
assert(utils.getAssetURL("foo/bar") === "foo/bar"); assert(utils.getAssetURL("foo/bar") === "foo/bar");
assert(utils.getAssetURL("foo/bar") === "foo/bar"); assert(utils.getAssetURL("foo/bar") === "foo/bar");
}); });
it('getThemeCSS', () => { test('getThemeCSS', () => {
styles.getThemeCSS(); styles.getThemeCSS();
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment