mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Added application module tests.
This commit is contained in:
15
Tests/application-tests-common.ts
Normal file
15
Tests/application-tests-common.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import app = require("application/application");
|
||||
import TKUnit = require("Tests/TKUnit");
|
||||
|
||||
export var testInitDefined = function () {
|
||||
TKUnit.assert(app.init, "init function not defined.");
|
||||
}
|
||||
|
||||
export var testInitialized = function () {
|
||||
if (android) {
|
||||
// we have the android defined
|
||||
TKUnit.assert(app.android, "Application module not properly intialized");
|
||||
} else if (Foundation) {
|
||||
TKUnit.assert(app.ios, "Application module not properly intialized");
|
||||
}
|
||||
}
|
||||
16
Tests/application-tests.android.ts
Normal file
16
Tests/application-tests.android.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import app = require("application/application");
|
||||
import TKUnit = require("Tests/TKUnit");
|
||||
import commonTests = require("Tests/application-tests-common");
|
||||
|
||||
// merge the exports of the application_common file with the exports of this file
|
||||
declare var exports;
|
||||
require("utils/module-merge").merge(commonTests, exports);
|
||||
|
||||
export var testAndroidApplicationInitialized = function () {
|
||||
TKUnit.assert(app.android, "Android application not initialized.");
|
||||
TKUnit.assert(app.android.context, "Android context not initialized.");
|
||||
TKUnit.assert(app.android.currentActivity, "Android currentActivity not initialized.");
|
||||
TKUnit.assert(app.android.startActivity, "Android mainActivity not initialized.");
|
||||
TKUnit.assert(app.android.nativeApp, "Android nativeApp not initialized.");
|
||||
TKUnit.assert(app.android.packageName, "Android packageName not initialized.");
|
||||
}
|
||||
1
Tests/application-tests.ios.ts
Normal file
1
Tests/application-tests.ios.ts
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -65,7 +65,8 @@ export var testNativeFields = function () {
|
||||
|
||||
var getTestImageName = function (): string {
|
||||
if (app.ios) {
|
||||
return "AppIcon";
|
||||
// TODO: This expects
|
||||
return "logo";
|
||||
}
|
||||
if (app.android) {
|
||||
return "ic_launcher";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var TKUnit = require("Tests/TKUnit");
|
||||
|
||||
var allTests = {};
|
||||
allTests["APPLICATION"] = require("Tests/application-tests");
|
||||
allTests["FILE SYSTEM"] = require("Tests/file-system-tests");
|
||||
allTests["HTTP"] = require("Tests/http-tests");
|
||||
allTests["LOCATION"] = require("Tests/location-tests");
|
||||
|
||||
Reference in New Issue
Block a user