Skip to content

Commit 1f319e4

Browse files
committed
chore: restore test of global APIs based on loading a script tag
1 parent 8cf9fd8 commit 1f319e4

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

test/integration/docsify.test.js renamed to test/e2e/docsify.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ const docsifyInit = require('../helpers/docsify-init');
55
describe('Docsify', function() {
66
// Tests
77
// ---------------------------------------------------------------------------
8+
it('global APIs are available', async () => {
9+
await docsifyInit();
10+
11+
// If the script was built successfully for production, then it should load
12+
// and the following APIs should be available:
13+
expect(typeof window.Docsify).toEqual('object');
14+
expect(typeof window.Docsify.util).toEqual('object');
15+
expect(typeof window.Docsify.dom).toEqual('object');
16+
expect(typeof window.Docsify.get).toEqual('function');
17+
expect(typeof window.Docsify.slugify).toEqual('function');
18+
expect(typeof window.Docsify.version).toEqual('string');
19+
expect(typeof window.DocsifyCompiler).toEqual('function');
20+
expect(typeof window.marked).toEqual('function');
21+
expect(typeof window.Prism).toEqual('object');
22+
});
23+
824
test('allows $docsify configuration to be a function', async () => {
925
const testConfig = jest.fn(vm => {
1026
expect(vm).toBeInstanceOf(Object);

test/integration/global-apis.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import initGlobalAPI from '../../src/core/global-api.js';
22

33
// Suite
44
// -----------------------------------------------------------------------------
5-
describe('Global APIs', function() {
5+
describe('initGlobalAPI', function() {
66
// Tests
77
// ---------------------------------------------------------------------------
8-
test('APIs are available', () => {
8+
test('it makes Docsify APIs available globally', () => {
99
initGlobalAPI();
1010

1111
expect(typeof window.Docsify).toEqual('object');

0 commit comments

Comments
 (0)