playable
Version:
Video player based on HTML5Video
48 lines (39 loc) • 1.12 kB
text/typescript
import { expect } from 'chai';
import TextMap from './text-map';
import createPlayerTestkit from '../../testkit';
describe('TextMap module', () => {
let testkit: any;
beforeEach(() => {
testkit = createPlayerTestkit();
testkit.registerModule('textMap', TextMap);
});
it('should have ability to get text from it', () => {
testkit.setConfig({
texts: {
testID: 'testText',
},
});
const map = testkit.getModule('textMap');
expect(map.get).to.exist;
expect(map.get('testID')).to.be.equal('testText');
});
it('should pass arguments to translate function', () => {
testkit.setConfig({
texts: {
testID: ({ arg }: { arg: any }) => `Test:${arg}`,
},
});
const map = testkit.getModule('textMap');
expect(map.get('testID', { arg: 1 })).to.be.equal('Test:1');
});
it('should return undefined if destroyed', () => {
testkit.setConfig({
texts: {
testID: 'testText',
},
});
const map = testkit.getModule('textMap');
map.destroy();
expect(map.get('testID')).to.be.equal(undefined);
});
});