Update test script

This commit is contained in:
Mimi 2025-03-31 13:49:53 +08:00
parent 5f4210feab
commit 8699177369
15 changed files with 8 additions and 20 deletions

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

2
test/index.js vendored
View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
require('chai').should();
describe('NexT', () => { describe('NexT', () => {
require('./helpers'); require('./helpers');
require('./tags'); require('./tags');

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const result = `<div class="link-grid"><div class="link-grid-container"> const result = `<div class="link-grid"><div class="link-grid-container">
<object class="link-grid-image" data="/images/sample.png"></object> <object class="link-grid-image" data="/images/sample.png"></object>

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const { escapeHTML } = require('hexo-util'); const { escapeHTML } = require('hexo-util');

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
const Hexo = require('hexo'); const Hexo = require('hexo');
const hexo = new Hexo(); const hexo = new Hexo();

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('chai').should();
describe('video', () => { describe('video', () => {
const postVideo = require('../../scripts/tags/video'); const postVideo = require('../../scripts/tags/video');

View File

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