Skip to content

Commit baba449

Browse files
Vasil ChimevVasil Chimev
Vasil Chimev
authored and
Vasil Chimev
committed
Add test_201_transpilation_after_node_modules_deleted.
NativeScript/nativescript-cli#1184
1 parent 2660139 commit baba449

File tree

1 file changed

+13
-176
lines changed

1 file changed

+13
-176
lines changed

tests/transpilation_typescript.py

+13-176
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# C0111 - Missing docstring
77
# R0201 - Method could be a function
88
# R0904 - Too many public methods
9-
# pylint: disable=C0111, R0201
9+
# pylint: disable=C0103, C0111, R0201
1010

1111
import platform, unittest
1212

@@ -18,6 +18,10 @@
1818

1919
class TranspilationTypeScript(unittest.TestCase):
2020

21+
@classmethod
22+
def setUpClass(cls):
23+
cleanup_folder('TNS_App')
24+
2125
def setUp(self):
2226

2327
print ""
@@ -26,12 +30,14 @@ def setUp(self):
2630
print "#####"
2731
print ""
2832

29-
cleanup_folder('TNS_App')
30-
3133
def tearDown(self):
34+
pass
35+
36+
@classmethod
37+
def tearDownClass(cls):
3238
cleanup_folder('TNS_App')
3339

34-
def test_001_transpilation_ts(self):
40+
def test_001_transpilation_typescript(self):
3541
create_project(proj_name="TNS_App", copy_from="template-hello-world-ts")
3642
platform_add(platform="android", framework_path=ANDROID_RUNTIME_PATH, path="TNS_App")
3743

@@ -91,175 +97,6 @@ def test_001_transpilation_ts(self):
9197
"TNS_App/platforms/ios/TNSApp/app/tns_modules", ".ts")
9298
build(platform="ios", path="TNS_App")
9399

94-
# output = run_aut(TNS_PATH + " prepare android --path TNS_App")
95-
# assert "Project successfully prepared" in output
96-
#
97-
# # Verify app and modules are processed and available in platform folder
98-
# assert file_exists(
99-
# 'TNS_App/platforms/android/src/main/assets/app/main-view-model.js')
100-
# assert file_exists(
101-
# 'TNS_App/platforms/android/src/main/assets/app/tns_modules/application/application.js')
102-
# assert not file_exists(
103-
# 'TNS_App/platforms/android/src/main/assets/app/tns_modules/" + \
104-
# "application/application.android.js')
105-
# assert not file_exists(
106-
# 'TNS_App/platforms/android/src/main/assets/app/tns_modules/" + \
107-
# "application/application.ios.js')
108-
#
109-
# def test_002_prepare_android_inside_project(self):
110-
# create_project_add_platform(
111-
# proj_name="TNS_App",
112-
# platform="android",
113-
# framework_path=ANDROID_RUNTIME_PATH)
114-
# current_dir = os.getcwd()
115-
# os.chdir(os.path.join(current_dir, "TNS_App"))
116-
# output = run_aut(os.path.join("..", TNS_PATH) + " prepare android")
117-
# os.chdir(current_dir)
118-
# assert "Project successfully prepared" in output
119-
#
120-
# # Verify app and modules are processed and available in platform folder
121-
# assert file_exists(
122-
# 'TNS_App/platforms/android/src/main/assets/app/main-view-model.js')
123-
# assert file_exists(
124-
# 'TNS_App/platforms/android/src/main/assets/app/tns_modules/application/application.js')
125-
# assert not file_exists(
126-
# 'TNS_App/platforms/android/src/main/assets/app/tns_modules/' + \
127-
# 'application/application.android.js')
128-
# assert not file_exists(
129-
# 'TNS_App/platforms/android/src/main/assets/app/tns_modules/application/application.ios.js')
130-
#
131-
# def test_010_prepare_android_tns_core_modules(self):
132-
# create_project(
133-
# proj_name="TNS_App",
134-
# copy_from="QA-TestApps/tns-modules-app/app")
135-
# platform_add(
136-
# platform="android",
137-
# path="TNS_App",
138-
# framework_path=ANDROID_RUNTIME_PATH)
139-
#
140-
# # Make a change in tns-core-modules to verify they are not overwritten.
141-
# replace(
142-
# "TNS_App/node_modules/tns-core-modules/application/application-common.js",
143-
# "(\"globals\");",
144-
# "(\"globals\"); // test")
145-
#
146-
# # Verify tns-core-modules are copied to the native project, not app's
147-
# # tns_modules.
148-
# for i in range(1, 3):
149-
# print "prepare number: " + str(i)
150-
#
151-
# output = run_aut(TNS_PATH + " prepare android --path TNS_App")
152-
# assert "You have tns_modules dir in your app folder" in output
153-
# assert "Project successfully prepared" in output
154-
#
155-
# output = run_aut("cat TNS_App/app/tns_modules/package.json")
156-
# assert "\"version\": \"1.2.1\"," in output
157-
#
158-
# output = run_aut(
159-
# "cat TNS_App/node_modules/tns-core-modules/package.json")
160-
# assert "\"version\": \"1.2.1\"," not in output
161-
# output = run_aut(
162-
# "cat TNS_App/node_modules/tns-core-modules/application/application-common.js")
163-
# assert "require(\"globals\"); // test" in output
164-
#
165-
# output = run_aut(
166-
# "cat TNS_App/platforms/android/src/main/assets/app/tns_modules/package.json")
167-
# assert "\"version\": \"1.2.1\"," not in output
168-
# output = run_aut(
169-
# "cat TNS_App/platforms/android/src/main/assets/app/" + \
170-
# "tns_modules/application/application-common.js")
171-
# assert "require(\"globals\"); // test" in output
172-
#
173-
# def test_210_prepare_android_patform_not_added(self):
174-
# create_project(proj_name="TNS_App")
175-
# output = run_aut(TNS_PATH + " prepare android --path TNS_App")
176-
# assert "Copying template files..." in output
177-
# assert "Project successfully created." in output
178-
# assert "Project successfully prepared" in output
179-
# assert file_exists(
180-
# 'TNS_App/platforms/android/src/main/assets/app/tns_modules/xml/xml.js')
181-
#
182-
# def test_300_prepare_android_remove_old_files(self):
183-
# create_project_add_platform(
184-
# proj_name="TNS_App",
185-
# platform="android",
186-
# framework_path=ANDROID_RUNTIME_PATH)
187-
# output = run_aut(TNS_PATH + " prepare android --path TNS_App")
188-
# assert "Project successfully prepared" in output
189-
#
190-
# assert file_exists(
191-
# 'TNS_App/platforms/android/src/main/assets/app/app.js')
192-
# assert file_exists(
193-
# 'TNS_App/platforms/android/src/main/assets/app/app.css')
194-
# assert file_exists(
195-
# 'TNS_App/platforms/android/src/main/assets/app/main-page.xml')
196-
#
197-
# run_aut("mv TNS_App/app/app.js TNS_App/app/app-new.js")
198-
# run_aut("mv TNS_App/app/app.css TNS_App/app/app-new.css")
199-
# run_aut("mv TNS_App/app/main-page.xml TNS_App/app/main-page-new.xml")
200-
#
201-
# output = run_aut(TNS_PATH + " prepare android --path TNS_App")
202-
# assert "Project successfully prepared" in output
203-
# assert file_exists(
204-
# 'TNS_App/platforms/android/src/main/assets/app/app-new.js')
205-
# assert file_exists(
206-
# 'TNS_App/platforms/android/src/main/assets/app/app-new.css')
207-
# assert file_exists(
208-
# 'TNS_App/platforms/android/src/main/assets/app/main-page-new.xml')
209-
#
210-
# assert not file_exists(
211-
# 'TNS_App/platforms/android/src/main/assets/app/app.js')
212-
# assert not file_exists(
213-
# 'TNS_App/platforms/android/src/main/assets/app/app.css')
214-
# assert not file_exists(
215-
# 'TNS_App/platforms/android/src/main/assets/app/main-page.xml')
216-
#
217-
# def test_301_prepare_android_platform_specific_files(self):
218-
# create_project_add_platform(
219-
# proj_name="TNS_App",
220-
# platform="android",
221-
# framework_path=ANDROID_RUNTIME_PATH)
222-
# output = run_aut(TNS_PATH + " prepare android --path TNS_App")
223-
# assert "Project successfully prepared" in output
224-
# assert file_exists(
225-
# 'TNS_App/platforms/android/src/main/assets/app/app.css')
226-
#
227-
# run_aut("cp TNS_App/app/app.js TNS_App/app/app.ios.js")
228-
# run_aut("cp TNS_App/app/app.js TNS_App/app/app.android.js")
229-
# run_aut("cp TNS_App/app/app.js TNS_App/app/appios.js")
230-
# run_aut("cp TNS_App/app/app.js TNS_App/app/appandroid.js")
231-
# run_aut("cp TNS_App/app/app.js TNS_App/app/ios.js")
232-
# run_aut("cp TNS_App/app/app.js TNS_App/app/android.js")
233-
# run_aut("cp TNS_App/app/app.css TNS_App/app/app.ios.css")
234-
# run_aut("cp TNS_App/app/app.css TNS_App/app/app.android.css")
235-
# run_aut("mv TNS_App/app/app.js TNS_App/app/appNew.js")
236-
# run_aut("mv TNS_App/app/app.css TNS_App/app/appNew.css")
237-
#
238-
# output = run_aut(TNS_PATH + " prepare android --path TNS_App")
239-
# assert "Project successfully prepared" in output
240-
# assert file_exists(
241-
# 'TNS_App/platforms/android/src/main/assets/app/app.css')
242-
# assert file_exists(
243-
# 'TNS_App/platforms/android/src/main/assets/app/app.js')
244-
# assert file_exists(
245-
# 'TNS_App/platforms/android/src/main/assets/app/appandroid.js')
246-
# assert file_exists(
247-
# 'TNS_App/platforms/android/src/main/assets/app/appios.js')
248-
# assert file_exists(
249-
# 'TNS_App/platforms/android/src/main/assets/app/android.js')
250-
# assert file_exists(
251-
# 'TNS_App/platforms/android/src/main/assets/app/ios.js')
252-
# assert not file_exists(
253-
# 'TNS_App/platforms/android/src/main/assets/app/app.ios.css')
254-
# assert not file_exists(
255-
# 'TNS_App/platforms/android/src/main/assets/app/app.android.css')
256-
#
257-
# def test_400_prepare_missing_platform(self):
258-
# create_project(proj_name="TNS_App")
259-
# output = run_aut(TNS_PATH + " prepare --path TNS_App")
260-
# assert "You need to provide all the required parameters." in output
261-
#
262-
# def test_401_prepare_invalid_platform(self):
263-
# create_project(proj_name="TNS_App")
264-
# output = run_aut(TNS_PATH + " prepare windows --path TNS_App")
265-
# assert "Invalid platform windows. Valid platforms are ios or android." in output
100+
def test_201_transpilation_after_node_modules_deleted(self):
101+
run_aut("rm -rf TNS_App/node_modules")
102+
prepare(platform="android", path="TNS_App")

0 commit comments

Comments
 (0)