12
12
class TnsAssert (object ):
13
13
14
14
@staticmethod
15
- def created (app_name , output = None , app_data = None , path = Settings .TEST_RUN_HOME , theme = True ):
15
+ def created (app_name , output = None , app_data = None , path = Settings .TEST_RUN_HOME , webpack = True , theme = True ):
16
16
"""
17
17
Verify app is created properly.
18
18
:param app_name: Name of the app.
@@ -33,31 +33,33 @@ def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME, t
33
33
assert 'After that you can run it on device/emulator by executing $ tns run <platform>' not in output
34
34
assert 'Project {0} was successfully created' .format (app ) in output , 'Failed to create {0}' .format (app )
35
35
36
- # Assert app data
37
- if app_data is not None :
38
- # Verify modules installed
39
- node_path = TnsHelpers .get_app_node_modules_path (app_name = app_name , path = path )
40
- assert Folder .exists (os .path .join (node_path , 'tns-core-modules' )), '{N} theme do not exists in app.'
41
- assert File .exists (os .path .join (node_path , 'tns-core-modules' , 'tns-core-modules.d.ts' ))
36
+ # Verify modules installed
37
+ node_path = TnsHelpers .get_app_node_modules_path (app_name = app_name , path = path )
38
+ assert Folder .exists (os .path .join (node_path , 'tns-core-modules' )), '{N} theme do not exists in app.'
39
+ assert File .exists (os .path .join (node_path , 'tns-core-modules' , 'tns-core-modules.d.ts' ))
42
40
43
- # Verify {N} core theme is installed
44
- if theme :
45
- assert Folder .exists (os .path .join (node_path , 'nativescript-theme-core' )), '{N} theme do not exists.'
41
+ # Verify {N} core theme is installed
42
+ if theme :
43
+ assert Folder .exists (os .path .join (node_path , 'nativescript-theme-core' )), '{N} theme do not exists.'
46
44
47
- # Verify webpack is installed
45
+ # Verify webpack is installed
46
+ if webpack :
48
47
before_watch_hooks = os .path .join (app_path , 'hooks' , 'before-watch' )
49
48
assert Folder .exists (os .path .join (node_path , 'nativescript-dev-webpack' )), 'Webpack not installed in app.'
50
49
assert File .exists (os .path .join (app_path , 'webpack.config.js' )), 'Missing webpack config.'
51
50
assert File .exists (os .path .join (before_watch_hooks , 'nativescript-dev-webpack.js' )), 'Hooks not installed.'
52
51
53
- # Verify typescript in TS and NG apps:
54
- if app_data .app_type in {AppType .TS , AppType .NG , AppType .SHARED_NG }:
55
- assert Folder .exists (os .path .join (node_path , 'nativescript-dev-typescript' )), 'TS not installed in app.'
56
- assert File .exists (os .path .join (app_path , 'tsconfig.json' )), 'Missing config.'
52
+ # Verify typescript in TS and NG apps:
53
+ if app_data .app_type in {AppType .TS , AppType .NG , AppType .SHARED_NG }:
54
+ assert Folder .exists (os .path .join (node_path , 'nativescript-dev-typescript' )), 'TS not installed in app.'
55
+ assert File .exists (os .path .join (app_path , 'tsconfig.json' )), 'Missing config.'
56
+ if webpack :
57
57
assert File .exists (os .path .join (app_path , 'tsconfig.tns.json' )), 'Missing config.'
58
- assert File .exists (os .path .join (before_watch_hooks , 'nativescript-dev-typescript.js' )), \
59
- 'Hooks not installed.'
58
+ assert File .exists (os .path .join (before_watch_hooks , 'nativescript-dev-typescript.js' )), \
59
+ 'Hooks not installed.'
60
60
61
+ # Assert app data
62
+ if app_data is not None :
61
63
# Assert app id
62
64
if app_data .bundle_id is not None :
63
65
pass
0 commit comments