|
| 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 path from "path"; |
| 6 | +import { SettingsHelper } from "../../src/extension/settingsHelper"; |
| 7 | + |
| 8 | +suite("workspace", function () { |
| 9 | + suite("extensionContext", function () { |
| 10 | + test("Should get react-native.workspace.exclude correctly from workspace settings file", async function () { |
| 11 | + const noWorkspacePath = undefined; |
| 12 | + const exclude1 = await SettingsHelper.getWorkspaceFileExcludeFolder(noWorkspacePath); |
| 13 | + assert.strictEqual(exclude1.length, 0); |
| 14 | + |
| 15 | + const noExcludeWorkspacePath = path.resolve( |
| 16 | + __dirname, |
| 17 | + "..", |
| 18 | + "resources", |
| 19 | + "workspaceSettingsSample", |
| 20 | + "noExcludeSetting.json", |
| 21 | + ); |
| 22 | + const exclude2 = await SettingsHelper.getWorkspaceFileExcludeFolder( |
| 23 | + noExcludeWorkspacePath, |
| 24 | + ); |
| 25 | + assert.strictEqual(exclude2.length, 0); |
| 26 | + |
| 27 | + const excludeWorkspacePath = path.resolve( |
| 28 | + __dirname, |
| 29 | + "..", |
| 30 | + "resources", |
| 31 | + "workspaceSettingsSample", |
| 32 | + "excludeSetting.json", |
| 33 | + ); |
| 34 | + const exclude3 = await SettingsHelper.getWorkspaceFileExcludeFolder( |
| 35 | + excludeWorkspacePath, |
| 36 | + ); |
| 37 | + assert.strictEqual(exclude3.length, 1); |
| 38 | + assert.strictEqual(exclude3[0], "testProject2"); |
| 39 | + }); |
| 40 | + }); |
| 41 | +}); |
0 commit comments