Comparing version 1.6.0-beta to 1.7.0-beta
{ | ||
"name": "code-push", | ||
"version": "1.6.0-beta", | ||
"version": "1.7.0-beta", | ||
"description": "Management SDK for the CodePush service", | ||
@@ -20,5 +20,4 @@ "main": "script/index.js", | ||
"q": "^1.4.1", | ||
"superagent": "^1.7.2", | ||
"try-json": "^1.0.0" | ||
"superagent": "^1.7.2" | ||
} | ||
} |
@@ -1,4 +0,2 @@ | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
__export(require("./management/account-manager")); | ||
var AccountManager = require("./management-sdk"); | ||
module.exports = AccountManager; |
/// <reference path="../definitions/harness.d.ts" /> | ||
var assert = require("assert"); | ||
var Q = require("q"); | ||
var account_manager_1 = require("../script/management/account-manager"); | ||
var AccountManager = require("../script/management-sdk"); | ||
var request = require("superagent"); | ||
@@ -9,3 +9,3 @@ var manager; | ||
beforeEach(function () { | ||
manager = new account_manager_1.AccountManager("http://localhost", "unit-test/1.0.0"); | ||
manager = new AccountManager("dummyAccessKey", null, "http://localhost"); | ||
}); | ||
@@ -20,13 +20,10 @@ after(function () { | ||
manager.addApp.bind(manager, "appName"), | ||
manager.getApp.bind(manager, "appId"), | ||
manager.updateApp.bind(manager, {}), | ||
manager.removeApp.bind(manager, "appId"), | ||
manager.addDeployment.bind(manager, "appId", "name"), | ||
manager.getDeployment.bind(manager, "appId", "deploymentId"), | ||
manager.getDeployments.bind(manager, "appId"), | ||
manager.updateDeployment.bind(manager, "appId", { id: "deploymentToChange" }), | ||
manager.removeDeployment.bind(manager, "appId", { id: "deploymentToChange" }), | ||
manager.getDeploymentKeys.bind(manager, "appId", "deploymentId"), | ||
manager.getPackage.bind(manager, ""), | ||
manager.logout.bind(manager), | ||
manager.getApp.bind(manager, "appName"), | ||
manager.renameApp.bind(manager, "appName", {}), | ||
manager.removeApp.bind(manager, "appName"), | ||
manager.addDeployment.bind(manager, "appName", "deploymentName"), | ||
manager.getDeployment.bind(manager, "appName", "deploymentName"), | ||
manager.getDeployments.bind(manager, "appName"), | ||
manager.renameDeployment.bind(manager, "appName", "deploymentName", { name: "newDeploymentName" }), | ||
manager.removeDeployment.bind(manager, "appName", "deploymentName"), | ||
]; | ||
@@ -79,4 +76,4 @@ var result = Q(null); | ||
}); | ||
it("addApp handles location header", function (done) { | ||
mockReturn(JSON.stringify({ success: true }), 200, { location: "/appId" }); | ||
it("addApp handles successful response", function (done) { | ||
mockReturn(JSON.stringify({ success: true }), 201, { location: "/appName" }); | ||
manager.addApp("appName").done(function (obj) { | ||
@@ -87,12 +84,11 @@ assert.ok(obj); | ||
}); | ||
it("addApp handles missing location header", function (done) { | ||
mockReturn(JSON.stringify({ success: true }), 200, {}); | ||
it("addApp handles error response", function (done) { | ||
mockReturn(JSON.stringify({ success: false }), 404, {}); | ||
manager.addApp("appName").done(function (obj) { | ||
assert.ok(!obj); | ||
done(); | ||
}, rejectHandler); | ||
throw new Error("Call should not complete successfully"); | ||
}, function (error) { return done(); }); | ||
}); | ||
it("getApp handles JSON response", function (done) { | ||
mockReturn(JSON.stringify({ app: {} }), 200, {}); | ||
manager.getApp("appId").done(function (obj) { | ||
manager.getApp("appName").done(function (obj) { | ||
assert.ok(obj); | ||
@@ -104,3 +100,3 @@ done(); | ||
mockReturn(JSON.stringify({ apps: [] }), 200, {}); | ||
manager.updateApp({}).done(function (obj) { | ||
manager.renameApp("appName", "newAppName").done(function (obj) { | ||
assert.ok(!obj); | ||
@@ -112,3 +108,3 @@ done(); | ||
mockReturn("", 200, {}); | ||
manager.removeApp("appId").done(function (obj) { | ||
manager.removeApp("appName").done(function (obj) { | ||
assert.ok(!obj); | ||
@@ -119,4 +115,4 @@ done(); | ||
it("addDeployment handles success response", function (done) { | ||
mockReturn("", 200, { location: "/deploymentId" }); | ||
manager.addDeployment("appId", "name").done(function (obj) { | ||
mockReturn(JSON.stringify({ deployment: { name: "name", key: "key" } }), 201, { location: "/deploymentName" }); | ||
manager.addDeployment("appName", "deploymentName").done(function (obj) { | ||
assert.ok(obj); | ||
@@ -126,12 +122,5 @@ done(); | ||
}); | ||
it("addDeployment handles missing location header", function (done) { | ||
mockReturn("", 200, {}); | ||
manager.addDeployment("appId", "name").done(function (obj) { | ||
assert.ok(!obj); | ||
done(); | ||
}, rejectHandler); | ||
}); | ||
it("getDeployment handles JSON response", function (done) { | ||
mockReturn(JSON.stringify({ deployment: {} }), 200, {}); | ||
manager.getDeployment("appId", "deploymentId").done(function (obj) { | ||
manager.getDeployment("appName", "deploymentName").done(function (obj) { | ||
assert.ok(obj); | ||
@@ -143,3 +132,3 @@ done(); | ||
mockReturn(JSON.stringify({ deployments: [] }), 200, {}); | ||
manager.getDeployments("appId").done(function (obj) { | ||
manager.getDeployments("appName").done(function (obj) { | ||
assert.ok(obj); | ||
@@ -149,5 +138,5 @@ done(); | ||
}); | ||
it("updateDeployment handles success response", function (done) { | ||
it("renameDeployment handles success response", function (done) { | ||
mockReturn(JSON.stringify({ apps: [] }), 200, {}); | ||
manager.updateDeployment("appId", { id: "deploymentId" }).done(function (obj) { | ||
manager.renameDeployment("appName", "deploymentName", "newDeploymentName").done(function (obj) { | ||
assert.ok(!obj); | ||
@@ -159,3 +148,3 @@ done(); | ||
mockReturn("", 200, {}); | ||
manager.removeDeployment("appId", "deploymentId").done(function (obj) { | ||
manager.removeDeployment("appName", "deploymentName").done(function (obj) { | ||
assert.ok(!obj); | ||
@@ -165,20 +154,6 @@ done(); | ||
}); | ||
it("getDeploymentKeys handles JSON response", function (done) { | ||
mockReturn(JSON.stringify({ deploymentKeys: [] }), 200, {}); | ||
manager.getDeploymentKeys("appId", "deploymentId").done(function (obj) { | ||
it("getDeploymentHistory handles success response with no packages", function (done) { | ||
mockReturn(JSON.stringify({ history: [] }), 200); | ||
manager.getDeploymentHistory("appName", "deploymentName").done(function (obj) { | ||
assert.ok(obj); | ||
done(); | ||
}, rejectHandler); | ||
}); | ||
it("getPackage handles success response", function (done) { | ||
mockReturn(JSON.stringify({ package: {} }), 200); | ||
manager.getPackage("appId", "deploymentId").done(function (obj) { | ||
assert.ok(obj); | ||
done(); | ||
}, rejectHandler); | ||
}); | ||
it("getPackageHistory handles success response with no packages", function (done) { | ||
mockReturn(JSON.stringify({ packageHistory: [] }), 200); | ||
manager.getPackageHistory("appId", "deploymentId").done(function (obj) { | ||
assert.ok(obj); | ||
assert.equal(obj.length, 0); | ||
@@ -188,5 +163,5 @@ done(); | ||
}); | ||
it("getPackageHistory handles success response with two packages", function (done) { | ||
mockReturn(JSON.stringify({ packageHistory: [{ label: "v1" }, { label: "v2" }] }), 200); | ||
manager.getPackageHistory("appId", "deploymentId").done(function (obj) { | ||
it("getDeploymentHistory handles success response with two packages", function (done) { | ||
mockReturn(JSON.stringify({ history: [{ label: "v1" }, { label: "v2" }] }), 200); | ||
manager.getDeploymentHistory("appName", "deploymentName").done(function (obj) { | ||
assert.ok(obj); | ||
@@ -199,5 +174,5 @@ assert.equal(obj.length, 2); | ||
}); | ||
it("getPackageHistory handles error response", function (done) { | ||
it("getDeploymentHistory handles error response", function (done) { | ||
mockReturn("", 404); | ||
manager.getPackageHistory("appId", "deploymentId").done(function (obj) { | ||
manager.getDeploymentHistory("appName", "deploymentName").done(function (obj) { | ||
throw new Error("Call should not complete successfully"); | ||
@@ -204,0 +179,0 @@ }, function (error) { return done(); }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
109224
4
15
2408
0
88
3
- Removedtry-json@^1.0.0
- Removedtry-json@1.0.1(transitive)