Commit 4d248e7 1 parent 8961357 commit 4d248e7 Copy full SHA for 4d248e7
File tree 2 files changed +40
-1
lines changed
2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- module . exports = [ ] ;
3
+ function ensureSettingsFolder ( ) {
4
+ const cwd = process . cwd ( ) ;
5
+ const fs = require ( 'fs-extra' ) ;
6
+ const path = require ( 'path' ) ;
7
+
8
+ fs . ensureDirSync ( path . resolve ( cwd , 'content' , 'settings' ) ) ;
9
+ }
10
+
11
+ module . exports = [ {
12
+ before : '1.7.0' ,
13
+ title : 'Create content/settings directory' ,
14
+ task : ensureSettingsFolder
15
+ } ] ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const expect = require ( 'chai' ) . expect ;
4
+ const sinon = require ( 'sinon' ) ;
5
+
6
+ const migrations = require ( '../../lib/migrations' ) ;
7
+
8
+ describe ( 'Unit: Migrations' , function ( ) {
9
+ describe ( 'ensureSettingsFolder' , function ( ) {
10
+ const setupEnv = require ( '../utils/env' ) ;
11
+ const path = require ( 'path' ) ;
12
+ const fs = require ( 'fs' ) ;
13
+
14
+ it ( 'creates settings folder if not existant' , function ( ) {
15
+ const env = setupEnv ( ) ;
16
+ const cwdStub = sinon . stub ( process , 'cwd' ) . returns ( env . dir ) ;
17
+ const ensureSettingsFolder = migrations [ 0 ] . task ;
18
+
19
+ ensureSettingsFolder ( ) ;
20
+ expect ( cwdStub . calledOnce ) . to . be . true ;
21
+ expect ( fs . existsSync ( path . join ( env . dir , 'content/settings' ) ) ) . to . be . true ;
22
+
23
+ cwdStub . restore ( ) ;
24
+ env . cleanup ( ) ;
25
+ } ) ;
26
+ } ) ;
27
+ } ) ;
You can’t perform that action at this time.
0 commit comments