File tree 2 files changed +30
-2
lines changed 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,34 @@ const docsifyInit = require('../helpers/docsify-init');
5
5
describe ( 'Docsify' , function ( ) {
6
6
// Tests
7
7
// ---------------------------------------------------------------------------
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 ( await page . evaluate ( ( ) => typeof window . Docsify ) ) . toEqual ( 'object' ) ;
14
+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . util ) ) . toEqual (
15
+ 'object'
16
+ ) ;
17
+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . dom ) ) . toEqual (
18
+ 'object'
19
+ ) ;
20
+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . get ) ) . toEqual (
21
+ 'function'
22
+ ) ;
23
+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . slugify ) ) . toEqual (
24
+ 'function'
25
+ ) ;
26
+ expect ( await page . evaluate ( ( ) => typeof window . Docsify . version ) ) . toEqual (
27
+ 'string'
28
+ ) ;
29
+ expect ( await page . evaluate ( ( ) => typeof window . DocsifyCompiler ) ) . toEqual (
30
+ 'function'
31
+ ) ;
32
+ expect ( await page . evaluate ( ( ) => typeof window . marked ) ) . toEqual ( 'function' ) ;
33
+ expect ( await page . evaluate ( ( ) => typeof window . Prism ) ) . toEqual ( 'object' ) ;
34
+ } ) ;
35
+
8
36
test ( 'allows $docsify configuration to be a function' , async ( ) => {
9
37
const testConfig = jest . fn ( vm => {
10
38
expect ( vm ) . toBeInstanceOf ( Object ) ;
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ import initGlobalAPI from '../../src/core/global-api.js';
2
2
3
3
// Suite
4
4
// -----------------------------------------------------------------------------
5
- describe ( 'Global APIs ' , function ( ) {
5
+ describe ( 'initGlobalAPI ' , function ( ) {
6
6
// Tests
7
7
// ---------------------------------------------------------------------------
8
- test ( 'APIs are available' , ( ) => {
8
+ test ( 'it makes Docsify APIs available globally ' , ( ) => {
9
9
initGlobalAPI ( ) ;
10
10
11
11
expect ( typeof window . Docsify ) . toEqual ( 'object' ) ;
You can’t perform that action at this time.
0 commit comments