Skip to content

Commit 71ffc0d

Browse files
committed
TA-4324: Refactor tests
1 parent 7a036fc commit 71ffc0d

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

tests/commands/configuration-management/module.spec.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe("Configuration Management Module - Action Validations", () => {
99
let module: Module;
1010
let mockCommand: Command;
1111
let mockConfigCommandService: jest.Mocked<ConfigCommandService>;
12+
const contextWithGitProfile = { gitProfile: "myProfile" } as any;
1213

1314
beforeEach(() => {
1415
jest.clearAllMocks();
@@ -83,8 +84,6 @@ describe("Configuration Management Module - Action Validations", () => {
8384

8485
describe("gitProfile and gitBranch validation", () => {
8586
it("should throw error when gitProfile is set in context without gitBranch option", async () => {
86-
const contextWithGitProfile = Object.assign(Object.create(Object.getPrototypeOf(testContext)), testContext);
87-
contextWithGitProfile.gitProfile = "myProfile";
8887
const options: OptionValues = {
8988
packageKeys: ["package1"],
9089
};
@@ -97,8 +96,6 @@ describe("Configuration Management Module - Action Validations", () => {
9796
});
9897

9998
it("should pass validation when gitProfile is set in context with gitBranch option", async () => {
100-
const contextWithGitProfile = Object.assign(Object.create(Object.getPrototypeOf(testContext)), testContext);
101-
contextWithGitProfile.gitProfile = "myProfile";
10299
const options: OptionValues = {
103100
packageKeys: ["package1"],
104101
gitBranch: "main",
@@ -197,8 +194,6 @@ describe("Configuration Management Module - Action Validations", () => {
197194

198195
describe("combined validation scenarios", () => {
199196
it("should fail on first validation error (packageKeys conflict) before checking gitProfile", async () => {
200-
const contextWithGitProfile = Object.assign(Object.create(Object.getPrototypeOf(testContext)), testContext);
201-
contextWithGitProfile.gitProfile = "myProfile";
202197
const options: OptionValues = {
203198
packageKeys: ["package1"],
204199
keysByVersion: ["package2:v1"],
@@ -216,8 +211,6 @@ describe("Configuration Management Module - Action Validations", () => {
216211
describe("batchImportPackages validation", () => {
217212
describe("gitProfile and gitBranch validation", () => {
218213
it("should throw error when gitProfile is set in context without gitBranch option", async () => {
219-
const contextWithGitProfile = Object.assign(Object.create(Object.getPrototypeOf(testContext)), testContext);
220-
contextWithGitProfile.gitProfile = "myProfile";
221214
const options: OptionValues = {
222215
file: "export.zip",
223216
};
@@ -230,8 +223,6 @@ describe("Configuration Management Module - Action Validations", () => {
230223
});
231224

232225
it("should pass validation when gitProfile is set in context with gitBranch option", async () => {
233-
const contextWithGitProfile = Object.assign(Object.create(Object.getPrototypeOf(testContext)), testContext);
234-
contextWithGitProfile.gitProfile = "myProfile";
235226
const options: OptionValues = {
236227
file: "export.zip",
237228
gitBranch: "main",

0 commit comments

Comments
 (0)