File tree 1 file changed +59
-0
lines changed
1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ var fs = require ( 'fs' ) ;
2
+
3
+ // Check if asset exists
4
+ function checkForAsset ( path ) {
5
+ var pathFound = true ;
6
+ try {
7
+ fs . accessSync ( path ) ;
8
+ } catch ( e ) {
9
+ pathFound = false ;
10
+ }
11
+ return pathFound ;
12
+ }
13
+
14
+ // Plugins
15
+ var plugins = [
16
+ 'Confirm' ,
17
+ 'Image' ,
18
+ 'Notice'
19
+ ] ;
20
+
21
+ // Themes
22
+ var themes = [
23
+ 'NoticeFancy' ,
24
+ 'TooltipBorder' ,
25
+ 'TooltipBorderThick' ,
26
+ 'TooltipDark' ,
27
+ 'TooltipError' ,
28
+ 'TooltipSmall' ,
29
+ 'TooltipSmallGray'
30
+ ] ;
31
+
32
+ // Check for default files
33
+ for ( let filename of [ 'jBox' , 'jBox.all' ] ) {
34
+ for ( let extension of [ '.js' , '.min.js' , '.css' , '.min.css' ] ) {
35
+ test ( 'Asset ' + filename + extension + ' exists' , ( ) => {
36
+ expect ( checkForAsset ( './dist/' + filename + extension ) ) . toBe ( true ) ;
37
+ } ) ;
38
+ }
39
+ }
40
+
41
+ // Check for plugin files
42
+ for ( let plugin of plugins ) {
43
+ for ( let extension of [ '.js' , '.min.js' , '.css' , '.min.css' ] ) {
44
+ let filename = 'jBox.' + plugin ;
45
+ test ( 'Plugin ' + plugin + ': Asset ' + filename + extension + ' exists' , ( ) => {
46
+ expect ( checkForAsset ( './dist/plugins/' + filename + extension ) ) . toBe ( true ) ;
47
+ } ) ;
48
+ }
49
+ }
50
+
51
+ // Check for theme files
52
+ for ( let theme of themes ) {
53
+ for ( let extension of [ '.css' , '.min.css' ] ) {
54
+ let filename = 'jBox.' + theme ;
55
+ test ( 'Theme ' + theme + ': Asset ' + filename + extension + ' exists' , ( ) => {
56
+ expect ( checkForAsset ( './dist/themes/' + filename + extension ) ) . toBe ( true ) ;
57
+ } ) ;
58
+ }
59
+ }
You can’t perform that action at this time.
0 commit comments