Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Edaena Salinas authored and Edaena Salinas committed Apr 23, 2020
1 parent 63200f9 commit 51de1c5
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/commands/project/append-variable-group.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { execute, CommandOptions } from "./append-variable-group";
import {
execute,
CommandOptions,
validateValues,
} from "./append-variable-group";
import * as appendVariableGrp from "./append-variable-group";
import * as fileutils from "../../lib/fileutils";
import { createTestBedrockYaml } from "../../test/mockFactory";
Expand All @@ -7,6 +11,7 @@ import { BedrockFile } from "../../types";
import { ConfigValues } from "./pipeline";
import * as bedrockYaml from "../../lib/bedrockYaml";
import * as variableGrp from "../../lib/pipelines/variableGroup";
import { deepClone } from "../../lib/util";

const mockValues: CommandOptions = {
devopsProject: "azDoProject",
Expand Down Expand Up @@ -76,3 +81,23 @@ describe("Test execute function", () => {
);
});
});
describe("test validateValues function", () => {
it("valid org and project name", () => {
const data = deepClone(mockValues);
validateValues(data);
});
it("invalid project name", () => {
const data = deepClone(mockValues);
data.devopsProject = "project\\abc";
expect(() => {
validateValues(data);
}).toThrow();
});
it("invalid org name", () => {
const data = deepClone(mockValues);
data.orgName = "org name";
expect(() => {
validateValues(data);
}).toThrow();
});
});

0 comments on commit 51de1c5

Please sign in to comment.