microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
test/debugger/ios/iOSPlatform.test.ts
68lines · 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 | |
| 6 | import { IOSPlatform } from "../../../src/common/ios/iOSPlatform"; |
| 7 | import { IRunOptions } from "../../../src/common/launchArgs"; |
| 8 | |
| 9 | import "should"; |
| 10 | |
| 11 | suite("iOSPlatform", function () { |
| 12 | let runOptions: IRunOptions = { |
| 13 | platform: "ios", |
| 14 | projectRoot: "/User/test/react-native/AwesomeProject", |
| 15 | }; |
| 16 | |
| 17 | teardown(() => { |
| 18 | runOptions = { |
| 19 | platform: "ios", |
| 20 | projectRoot: "/User/test/react-native/AwesomeProject", |
| 21 | }; |
| 22 | }); |
| 23 | suite("#debuggerContext", function () { |
| 24 | test("getRunArgument properties not defined", function () { |
| 25 | const expected = ["--simulator", IOSPlatform.DEFAULT_IOS_SIMULATOR_TARGET]; |
| 26 | let platform = new IOSPlatform(runOptions); |
| 27 | assert.deepEqual(platform.getRunArgument(), expected); |
| 28 | }); |
| 29 | test("getRunArgument simulator simulator", function () { |
| 30 | runOptions.target = "simulator"; |
| 31 | const expected = ["--simulator", IOSPlatform.DEFAULT_IOS_SIMULATOR_TARGET]; |
| 32 | let platform = new IOSPlatform(runOptions); |
| 33 | assert.deepEqual(platform.getRunArgument(), expected); |
| 34 | }); |
| 35 | test("getRunArgument device device", function () { |
| 36 | runOptions.target = "device"; |
| 37 | const expected = ["--device"]; |
| 38 | let platform = new IOSPlatform(runOptions); |
| 39 | assert.deepEqual(platform.getRunArgument(), expected); |
| 40 | }); |
| 41 | test("getRunArgument simulator iPhone 6", function () { |
| 42 | runOptions.target = "iPhone 6"; |
| 43 | const expected = ["--simulator", runOptions.target]; |
| 44 | let platform = new IOSPlatform(runOptions); |
| 45 | assert.deepEqual(platform.getRunArgument(), expected); |
| 46 | }); |
| 47 | test("getRunArgument simulator iPhone 7", function () { |
| 48 | runOptions.target = "iPhone 7"; |
| 49 | runOptions.targetType = "simulator"; |
| 50 | const expected = [`--${runOptions.targetType}`, runOptions.target]; |
| 51 | let platform = new IOSPlatform(runOptions); |
| 52 | assert.deepEqual(platform.getRunArgument(), expected); |
| 53 | }); |
| 54 | test("getRunArgument device Max's iPad", function () { |
| 55 | runOptions.target = "Max's iPad"; |
| 56 | runOptions.targetType = "device"; |
| 57 | const expected = [`--${runOptions.targetType}`, runOptions.target]; |
| 58 | let platform = new IOSPlatform(runOptions); |
| 59 | assert.deepEqual(platform.getRunArgument(), expected); |
| 60 | }); |
| 61 | test("getRunArgument default device", function () { |
| 62 | runOptions.targetType = "device"; |
| 63 | const expected = ["--device"]; |
| 64 | let platform = new IOSPlatform(runOptions); |
| 65 | assert.deepEqual(platform.getRunArgument(), expected); |
| 66 | }); |
| 67 | }); |
| 68 | }); |