microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/test/common/ios/xcodeproj.test.ts
33lines · 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 {Xcodeproj} from "../../../common/ios/xcodeproj"; |
| 5 | |
| 6 | import * as assert from "assert"; |
| 7 | import * as path from "path"; |
| 8 | import * as Q from "q"; |
| 9 | |
| 10 | suite("xcodeproj", function() { |
| 11 | suite("commonContext", function() { |
| 12 | test("should look in the correct location for xcodeproj files and return one", function() { |
| 13 | const projectRoot = path.join("/", "tmp", "myProject"); |
| 14 | const extension = "xcodeproj"; |
| 15 | const testFiles = ["foo.xcodeproj"]; |
| 16 | const mockFileSystem: any = { |
| 17 | findFilesByExtension: (path: string, ext: string) => { |
| 18 | if (extension !== ext) { |
| 19 | throw new Error(`Expected ${extension} got ${ext}`); |
| 20 | } |
| 21 | return Q(testFiles); |
| 22 | }, |
| 23 | }; |
| 24 | |
| 25 | const xcodeproj = new Xcodeproj({ nodeFileSystem: mockFileSystem }); |
| 26 | |
| 27 | return xcodeproj.findXcodeprojFile(projectRoot) |
| 28 | .then((file) => { |
| 29 | assert.equal(file, testFiles[0]); |
| 30 | }); |
| 31 | }); |
| 32 | }); |
| 33 | }); |