Skip to content

Commit e18aedd

Browse files
vchimevvchimev
vchimev
authored and
vchimev
committed
Add create project test
NativeScript/nativescript-cli#2209
1 parent 0e37a0e commit e18aedd

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ deviceLog.txt
88
output.txt
99
pylint*
1010
QA*
11-
temp*
1211
Report*
1312
setup*
1413
TestApp*

data/templates/myCustomTemplate/index.js

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "myCustomTemplate",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"lodash": "3.10.1"
6+
},
7+
"devDependencies": {
8+
"minimist": "1.2.0"
9+
},
10+
"description": "dummy",
11+
"license": "MIT",
12+
"readme": "dummy",
13+
"repository": "dummy"
14+
}

tests/build/Create_Tests.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def test_001_create_app(self):
5858
assert File.exists(self.app_name + "/node_modules/tns-core-modules/LICENSE")
5959
assert File.exists(self.app_name + "/node_modules/tns-core-modules/xml/xml.js")
6060

61-
6261
def test_002_create_project_with_path(self):
6362
Tns.create_app(self.app_name, attributes={"--path": "folder/subfolder/"},
6463
assert_success=False, update_modules=False)
@@ -136,6 +135,24 @@ def test_100_create_project_with_template(self, template_source):
136135
output = File.read(self.app_name + os.sep + "package.json")
137136
assert "\"id\": \"org.nativescript.TNSApp\"" in output
138137

138+
def test_101_create_project_with_local_directory_template(self):
139+
Tns.create_app(self.app_name, attributes={"--template": "./data/templates/myCustomTemplate/"},
140+
assert_success=False, update_modules=False)
141+
assert File.exists(self.app_name + "/app/index.js")
142+
assert File.exists(self.app_name + "/app/package.json")
143+
assert not Folder.is_empty(self.app_name + "/app/App_Resources/Android")
144+
assert not Folder.is_empty(self.app_name + "/app/App_Resources/iOS")
145+
assert not Folder.is_empty(self.app_name + "/node_modules/lodash")
146+
assert not Folder.is_empty(self.app_name + "/node_modules/minimist")
147+
assert not Folder.is_empty(self.app_name + "/node_modules/tns-core-modules")
148+
assert not Folder.is_empty(self.app_name + "/node_modules/tns-core-modules-widgets")
149+
assert Folder.is_empty(self.app_name + "/platforms")
150+
151+
output = File.read(self.app_name + os.sep + "package.json")
152+
assert "\"tns-core-modules\":" in output
153+
assert "\"lodash\": \"3.10.1\"" in output
154+
assert "\"minimist\": \"1.2.0\"" in output
155+
139156
def test_400_create_project_with_copyfrom_wrong_path(self):
140157
output = Tns.create_app(self.app_name, attributes={"--copy-from": "invalidFolder"},
141158
assert_success=False, update_modules=False)

0 commit comments

Comments
 (0)