microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/test/common/ios/xcodeproj.test.ts
33lines · modeblame
81226dceJimmy Thomson10 years ago | 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 | | |
f5edf87fJimmy Thomson10 years ago | 6 | import * as assert from "assert"; |
81226dceJimmy Thomson10 years ago | 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() { | |
2bc72bf2Jimmy Thomson10 years ago | 13 | const projectRoot = path.join("/", "tmp", "myProject"); |
81226dceJimmy Thomson10 years ago | 14 | const extension = "xcodeproj"; |
| 15 | const testFiles = ["foo.xcodeproj"]; | |
| 16 | const mockFileSystem: any = { | |
| 17 | findFilesByExtension: (path: string, ext: string) => { | |
| 18 | if (extension !== ext) { | |
db80cd4eJimmy Thomson10 years ago | 19 | throw new Error(`Expected ${extension} got ${ext}`); |
81226dceJimmy Thomson10 years ago | 20 | } |
| 21 | return Q(testFiles); | |
| 22 | } | |
db80cd4eJimmy Thomson10 years ago | 23 | }; |
| 24 | | |
81226dceJimmy Thomson10 years ago | 25 | const xcodeproj = new Xcodeproj({ nodeFileSystem: mockFileSystem }); |
| 26 | | |
| 27 | return xcodeproj.findXcodeprojFile(projectRoot) | |
| 28 | .then((file) => { | |
2bc72bf2Jimmy Thomson10 years ago | 29 | assert.equal(file, testFiles[0]); |
db80cd4eJimmy Thomson10 years ago | 30 | }); |
81226dceJimmy Thomson10 years ago | 31 | }); |
| 32 | }); | |
| 33 | }); |