Fix some file fallback retrieval for some langs. Added tests
This commit is contained in:
parent
1df41f1e5a
commit
1cf2a6883a
3 changed files with 49 additions and 2 deletions
40
test/file.test.js
Normal file
40
test/file.test.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* eslint-env mocha */
|
||||
/* eslint-disable func-names, prefer-arrow-callback */
|
||||
/* eslint-disable import/no-absolute-path */
|
||||
|
||||
import { chai } from 'meteor/practicalmeteor:chai';
|
||||
import { getFileNameOfLang } from '/imports/api/Utility/server/files.js';
|
||||
|
||||
describe('get file of page', () => {
|
||||
it('lang es retrieve es', async () => {
|
||||
chai.expect('pages/about-es.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'es'));
|
||||
});
|
||||
|
||||
it('lang en retrieve en', async () => {
|
||||
chai.expect('pages/about-en.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'en'));
|
||||
});
|
||||
|
||||
it('lang gl retrieve es', async () => {
|
||||
chai.expect('pages/about-es.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'gl'));
|
||||
});
|
||||
|
||||
it('lang ast retrieve es', async () => {
|
||||
chai.expect('pages/about-es.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'gl'));
|
||||
});
|
||||
|
||||
it('lang eu retrieve es', async () => {
|
||||
chai.expect('pages/about-es.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'eu'));
|
||||
});
|
||||
|
||||
it('lang ca retrieve es', async () => {
|
||||
chai.expect('pages/about-es.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'ca'));
|
||||
});
|
||||
|
||||
it('lang es-PE retrieve es', async () => {
|
||||
chai.expect('pages/about-es.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'es-PE'));
|
||||
});
|
||||
|
||||
it('lang es_PE retrieve es', async () => {
|
||||
chai.expect('pages/about-es.md').to.deep.equal(getFileNameOfLang('pages', 'about', 'md', 'es_PE'));
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue