mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
* Update test environments and lint configuration Update Jest (unit + integration) and Playwright (e2e) test environments. Includes stability improvements for e2e tests using newer, more stable methods per the Playwright docs. - Update Jest 26 => 27 - Update Jest-related libs (babel parser) - Update Playwright 1.8 => Playwright Test 1.18 - Update GitHub CI (action versions, job parallelization, and matrices) - Update ESLint 5 => 8 - Update ESLint-related libs (parser, prettier, Jest, Playwright) - Fix test failures on M1-based Macs - Fix e2e stability issues by replacing PW $ method calls - Fix ESLint errors - Fix incorrect CI flag on Jest runs (-ci => --ci) - Refactor e2e test runner from Jest to Playwright Test - Refactor e2e test files for Playwright Test - Refactor fix-lint script name to lint:fix for consistency - Refactor npm scripts order for readability - Remove unnecessary configs and libs - Remove example image snapshots
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
const docsifyInit = require('../helpers/docsify-init');
|
|
|
|
// Suite
|
|
// -----------------------------------------------------------------------------
|
|
describe('Docsify', function () {
|
|
// Tests
|
|
// ---------------------------------------------------------------------------
|
|
test('allows $docsify configuration to be a function', async () => {
|
|
const testConfig = jest.fn(vm => {
|
|
expect(vm).toBeInstanceOf(Object);
|
|
expect(vm.constructor.name).toBe('Docsify');
|
|
expect(vm.$fetch).toBeInstanceOf(Function);
|
|
expect(vm.$resetEvents).toBeInstanceOf(Function);
|
|
expect(vm.route).toBeInstanceOf(Object);
|
|
});
|
|
|
|
await docsifyInit({
|
|
config: testConfig,
|
|
});
|
|
|
|
expect(typeof Docsify).toBe('object');
|
|
expect(testConfig).toHaveBeenCalled();
|
|
});
|
|
|
|
test('provides the hooks and vm API to plugins', async () => {
|
|
const testConfig = jest.fn(vm => {
|
|
const vm1 = vm;
|
|
|
|
return {
|
|
plugins: [
|
|
function (hook, vm2) {
|
|
expect(vm1).toEqual(vm2);
|
|
|
|
expect(hook.init).toBeInstanceOf(Function);
|
|
expect(hook.beforeEach).toBeInstanceOf(Function);
|
|
expect(hook.afterEach).toBeInstanceOf(Function);
|
|
expect(hook.doneEach).toBeInstanceOf(Function);
|
|
expect(hook.mounted).toBeInstanceOf(Function);
|
|
expect(hook.ready).toBeInstanceOf(Function);
|
|
},
|
|
],
|
|
};
|
|
});
|
|
|
|
await docsifyInit({
|
|
config: testConfig,
|
|
});
|
|
|
|
expect(typeof Docsify).toBe('object');
|
|
expect(testConfig).toHaveBeenCalled();
|
|
});
|
|
});
|