Skip to content

Commit 2ff7e6a

Browse files
authored
feat: add theme parameter on TnsAsserts.created() (#23)
New: - Add theme parameter on TnsAsserts.created() Fixed: - Schematics tests where project is created with out styling
1 parent 3817b73 commit 2ff7e6a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

products/nativescript/tns_assert.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
class TnsAssert(object):
1313

1414
@staticmethod
15-
def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME):
15+
def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME, theme=True):
1616
"""
1717
Verify app is created properly.
1818
:param app_name: Name of the app.
1919
:param output: Console output of `tns create` command.
2020
:param app_data: AppInfo object.
2121
:param path: Base path where app is created.
22+
:param theme: If true it will verify default {N} theme is installed.
2223
"""
2324
# Assert app exists
2425
app_path = os.path.join(path, app_name)
@@ -40,7 +41,8 @@ def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME):
4041
assert File.exists(os.path.join(node_path, 'tns-core-modules', 'tns-core-modules.d.ts'))
4142

4243
# Verify {N} core theme is installed
43-
assert Folder.exists(os.path.join(node_path, 'nativescript-theme-core')), '{N} theme do not exists in app.'
44+
if theme:
45+
assert Folder.exists(os.path.join(node_path, 'nativescript-theme-core')), '{N} theme do not exists.'
4446

4547
# Verify webpack is installed
4648
before_watch_hooks = os.path.join(app_path, 'hooks', 'before-watch')

tests/code_sharing/ng_new_tests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ def create_and_run(shared=True, sample=False, theme=True, style=None, prefix=Non
104104
# Create shared project with sample data
105105
result = NG.new(collection=NS_SCHEMATICS, project=NGNewTests.app_name, theme=theme, shared=shared,
106106
sample=sample, style=style, prefix=prefix, source_dir=source_dir, webpack=webpack)
107-
TnsAssert.created(app_name=NGNewTests.app_name, app_data=app_data)
107+
108+
# Verify valid {N} app is created
109+
theme = True
110+
if style is None:
111+
theme = False
112+
TnsAssert.created(app_name=NGNewTests.app_name, app_data=app_data, theme=theme)
108113
assert 'Directory is already under version control. Skipping initialization of git.' in result.output, \
109114
'Git init should be skipped because app is created already existing repo (the one with tests).'
110115

0 commit comments

Comments
 (0)