Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
test on getting extensions for profile
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpowell committed Jul 3, 2019
1 parent 24929b2 commit 9dbe1f5
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/test/selectProfile.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
/* eslint @typescript-eslint/no-explicit-any: "off" */
import { assert } from "chai";
import * as vscode from "vscode";
import { ConfigKey, ConfigProfilesKey, ConfigStorageKey } from "../constants";
import {
ConfigKey,
ConfigProfilesKey,
ConfigStorageKey,
ConfigExtensionsKey
} from "../constants";
import Config from "../services/config";
import { ExtensionInfo } from "../services/extensions";

suite("select profile", () => {
const expectedProfileName = "test1";
const expectedProfileSettings = { foo: "bar" };
const expectedExtensions = [
new ExtensionInfo("abcd", "test.ext", "test", "1.0.0", "ext")
];

setup(async () => {
let config = vscode.workspace.getConfiguration(ConfigKey);
Expand All @@ -23,6 +32,13 @@ suite("select profile", () => {
},
vscode.ConfigurationTarget.Global
);
await config.update(
ConfigExtensionsKey,
{
[expectedProfileName]: expectedExtensions
},
vscode.ConfigurationTarget.Global
);
});

teardown(async () => {
Expand All @@ -38,6 +54,11 @@ suite("select profile", () => {
undefined,
vscode.ConfigurationTarget.Global
);
await config.update(
ConfigExtensionsKey,
undefined,
vscode.ConfigurationTarget.Global
);
});

test("list of profiles will contain the expected one", () => {
Expand All @@ -48,11 +69,19 @@ suite("select profile", () => {
assert.include(profiles, expectedProfileName);
});

test("storage contains the expected profile", () => {
test("storage contains the expected profile settings", () => {
let config = new Config();

let settings = config.getProfileSettings(expectedProfileName);

assert.deepEqual(settings, expectedProfileSettings);
});

test("storage contains the expected profile settings", () => {
let config = new Config();

let extensions = config.getProfileExtensions(expectedProfileName);

assert.deepEqual(extensions, expectedExtensions);
});
});

0 comments on commit 9dbe1f5

Please # to comment.