microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
test/extension/ios/iOSPlatform.test.ts
59lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | import * as assert from "assert"; |
| 5 | import * as sinon from "sinon"; |
| 6 | |
| 7 | import { IOSPlatform } from "../../../src/extension/ios/iOSPlatform"; |
| 8 | |
| 9 | import "should"; |
| 10 | import { SettingsHelper } from "../../../src/extension/settingsHelper"; |
| 11 | |
| 12 | suite("iOSPlatform", function () { |
| 13 | const projectRoot = "/User/test/react-native/AwesomeProject"; |
| 14 | let runOptions: any = { |
| 15 | platform: "ios", |
| 16 | workspaceRoot: "/User/test/react-native/AwesomeProject", |
| 17 | projectRoot: projectRoot, |
| 18 | }; |
| 19 | |
| 20 | const sandbox = sinon.sandbox.create(); |
| 21 | |
| 22 | setup(() => { |
| 23 | sandbox.stub(SettingsHelper, "getReactNativeProjectRoot", () => projectRoot); |
| 24 | }); |
| 25 | |
| 26 | teardown(() => { |
| 27 | runOptions = { |
| 28 | platform: "ios", |
| 29 | workspaceRoot: "/User/test/react-native/AwesomeProject", |
| 30 | projectRoot: "/User/test/react-native/AwesomeProject", |
| 31 | }; |
| 32 | sandbox.restore(); |
| 33 | }); |
| 34 | |
| 35 | suite("extensionContext", function () { |
| 36 | test("getRunArgument properties not defined", function () { |
| 37 | let platform = new IOSPlatform(runOptions); |
| 38 | assert.deepEqual(platform.getRunArgument(), []); |
| 39 | }); |
| 40 | test("getRunArgument simulator simulator", function () { |
| 41 | runOptions.target = "simulator"; |
| 42 | const expected = ["--simulator"]; |
| 43 | let platform = new IOSPlatform(runOptions); |
| 44 | assert.deepEqual(platform.getRunArgument(), expected); |
| 45 | }); |
| 46 | test("getRunArgument device device", function () { |
| 47 | runOptions.target = "device"; |
| 48 | const expected = ["--device"]; |
| 49 | let platform = new IOSPlatform(runOptions); |
| 50 | assert.deepEqual(platform.getRunArgument(), expected); |
| 51 | }); |
| 52 | test("getRunArgument simulator iPhone 6", function () { |
| 53 | runOptions.target = "iPhone 6"; |
| 54 | const expected = ["--simulator", runOptions.target]; |
| 55 | let platform = new IOSPlatform(runOptions); |
| 56 | assert.deepEqual(platform.getRunArgument(), expected); |
| 57 | }); |
| 58 | }); |
| 59 | }); |
| 60 | |