Mimi d248a3f9a6
Refactor vendors (#72)
* Compatibility with `@next-theme/plugins`

* Update test cases
2020-08-02 11:04:04 +08:00

36 lines
981 B
JavaScript

'use strict';
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const should = require('chai').should();
describe('Validate', () => {
it('config', () => {
const themeConfig = fs.readFileSync(path.join(__dirname, '../../_config.yml'));
should.not.throw(() => {
yaml.safeLoad(themeConfig);
});
});
it('vendors', () => {
const vendorsFile = fs.readFileSync(path.join(__dirname, '../../_vendors.yml'));
should.not.throw(() => {
yaml.safeLoad(vendorsFile);
});
});
it('language', () => {
const languagesPath = path.join(__dirname, '../../languages');
should.not.throw(() => {
fs.readdirSync(languagesPath).forEach(lang => {
if (!lang.endsWith('.yml')) return;
const languagePath = path.join(languagesPath, lang);
yaml.safeLoad(fs.readFileSync(languagePath), {
filename: path.relative(__dirname, languagePath)
});
});
});
});
});