Basic CLI test for 'deployment view' command

This commit is contained in:
Richard Hua 2015-11-09 18:01:58 -08:00
Родитель 0e7e2421ca
Коммит db9f34969f
1 изменённых файлов: 64 добавлений и 0 удалений

Просмотреть файл

@ -88,6 +88,28 @@ export class SdkStub {
}]);
}
public getPackageHistory(appId: string, deploymentId: string): Promise<codePush.Package[]> {
return Q([
<codePush.Package>{
appVersion: "1.0.0",
isMandatory: false,
packageHash: "463acc7d06adc9c46233481d87d9e8264b3e9ffe60fe98d721e6974209dc71a0",
blobUrl: "https://codepushstaging.blob.core.windows.net/storagev2/416cfQ5Ge",
uploadTime: 1447113596270,
label: "v1"
},
<codePush.Package>{
description: "New update - this update does a whole bunch of things, including testing linewrapping",
appVersion: "1.0.1",
isMandatory: false,
packageHash: "463acc7d06adc9c46233481d87d9e8264b3e9ffe60fe98d721e6974209dc71a0",
blobUrl: "https://codepushstaging.blob.core.windows.net/storagev2/4JpoBE5Gg",
uploadTime: 1447118476669,
label: "v2"
}
]);
}
public removeAccessKey(accessKeyId: string): Promise<void> {
return Q(<void>null);
}
@ -437,4 +459,46 @@ describe("CLI", () => {
done();
});
});
it("deploymentView lists package history information", (done: MochaDone): void => {
var command: cli.IDeploymentViewCommand = {
type: cli.CommandType.deploymentView,
appName: "a",
deploymentName: "Staging",
format: "json"
};
var getPackageHistory: Sinon.SinonSpy = sandbox.spy(cmdexec.sdk, "getPackageHistory");
cmdexec.execute(command)
.done((): void => {
sinon.assert.calledOnce(getPackageHistory);
sinon.assert.calledOnce(log);
assert.equal(log.args[0].length, 1);
var actual: string = log.args[0][0];
var expected: codePush.Package[] = [
<codePush.Package>{
description: "New update - this update does a whole bunch of things, including testing linewrapping",
appVersion: "1.0.1",
isMandatory: false,
packageHash: "463acc7d06adc9c46233481d87d9e8264b3e9ffe60fe98d721e6974209dc71a0",
blobUrl: "https://codepushstaging.blob.core.windows.net/storagev2/4JpoBE5Gg",
uploadTime: 1447118476669,
label: "v2"
},
<codePush.Package>{
appVersion: "1.0.0",
isMandatory: false,
packageHash: "463acc7d06adc9c46233481d87d9e8264b3e9ffe60fe98d721e6974209dc71a0",
blobUrl: "https://codepushstaging.blob.core.windows.net/storagev2/416cfQ5Ge",
uploadTime: 1447113596270,
label: "v1"
}
];
assertJsonDescribesObject(actual, expected);
done();
});
});
});