File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var fs = require ( 'fs' ) ;
4
+ var path = require ( 'path' ) ;
5
+
6
+ var initDataModule = {
7
+ path : '../lib/initData' ,
8
+ require : function ( ) {
9
+ return require ( this . path ) ;
10
+ } ,
11
+ teardown : function ( ) {
12
+ delete require . cache [ require . resolve ( this . path ) ] ;
13
+ }
14
+ } ;
15
+
16
+ var defaultConfig = {
17
+ path : path . join ( __dirname , '../protractor-conf.js' ) ,
18
+ setup : function ( ) {
19
+ fs . writeFileSync ( this . path , 'exports.config = {}' ) ;
20
+ } ,
21
+ teardown : function ( ) {
22
+ fs . unlinkSync ( this . path ) ;
23
+ }
24
+ } ;
25
+
26
+ var globalMocks = {
27
+ setup : function ( ) {
28
+ global . protractor = { } ;
29
+ global . browser = {
30
+ addMockModule : function ( ) { }
31
+ } ;
32
+ } ,
33
+ teardown : function ( ) {
34
+ delete global . protractor ;
35
+ delete global . browser ;
36
+ }
37
+ } ;
38
+
39
+
40
+ describe ( 'init data' , function ( ) {
41
+ beforeEach ( function ( ) {
42
+ this . initData = initDataModule . require ( ) ;
43
+ globalMocks . setup ( ) ;
44
+ defaultConfig . setup ( ) ;
45
+ } ) ;
46
+ afterEach ( function ( ) {
47
+ initDataModule . teardown ( ) ;
48
+ globalMocks . teardown ( ) ;
49
+ defaultConfig . teardown ( ) ;
50
+ } ) ;
51
+ } ) ;
You can’t perform that action at this time.
0 commit comments