habitica/website/client/tests/unit/libs/i18n.spec.js

29 lines
653 B
JavaScript
Raw Permalink Normal View History

import {
describe, expect, test, beforeEach,
} from 'vitest';
2019-10-09 18:08:36 +00:00
import Vue from 'vue';
import commoni18n from '@/../../common/script/i18n';
import i18n from '@/libs/i18n';
describe('i18n plugin', () => {
beforeEach(() => {
Vue.use(i18n, {
i18nData: {
strings: {
reportBug: 'Report a Bug',
},
},
});
});
test('adds $t to Vue.prototype', () => {
2018-02-19 18:38:20 +00:00
expect(Vue.prototype.$t).to.exist;
});
test('$t is a proxy for common/i18n.t', () => {
const result = (new Vue()).$t('reportBug');
expect(result).to.equal(commoni18n.t('reportBug'));
expect(result).to.equal('Report a Bug');
});
2019-10-09 18:08:36 +00:00
});