Skip to content

Commit

Permalink
test: git username test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Jan 17, 2025
1 parent cfc6268 commit e0d2a49
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions test/spec/Extn-Git-integ-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,6 @@ define(function (require, exports, module) {
$gitIcon = $("#git-toolbar-icon");
});

it("should git username and email be valid", async function () {
const tempUser = "phcodeTestGitUser";
const tempEmail = "[email protected]";
// username validate
let currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.name");
if(!currentVal) {
await testWindow.phoenixGitEvents.Git.setConfig("user.name", tempUser, true);
currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.name");
expect(currentVal).toBe(tempUser);
} else {
expect(currentVal).toBeDefined();
}
// email validate
currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.email");
if(!currentVal) {
await testWindow.phoenixGitEvents.Git.setConfig("user.email", tempEmail, true);
currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.email");
expect(currentVal).toBe(tempEmail);
} else {
expect(currentVal).toBeDefined();
}
});

it("should only git settings, init and clone commands be enabled in non-git repos", async function () {
await forCommandEnabled(Commands.CMD_GIT_INIT);
await forCommandEnabled(Commands.CMD_GIT_CLONE);
Expand Down Expand Up @@ -150,7 +127,6 @@ define(function (require, exports, module) {
}
}


it("Should clicking on file in git panel should open it", async function () {
await showGitPanel();
clickOpenFile(0);
Expand All @@ -163,6 +139,29 @@ define(function (require, exports, module) {
}, "first file to open");
});

it("should git username and email be valid", async function () {
const tempUser = "phcodeTestGitUser";
const tempEmail = "[email protected]";
// username validate
let currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.name");
if(!currentVal) {
await testWindow.phoenixGitEvents.Git.setConfig("user.name", tempUser, true);
currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.name");
expect(currentVal).toBe(tempUser);
} else {
expect(currentVal).toBeDefined();
}
// email validate
currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.email");
if(!currentVal) {
await testWindow.phoenixGitEvents.Git.setConfig("user.email", tempEmail, true);
currentVal = await testWindow.phoenixGitEvents.Git.getConfig("user.email");
expect(currentVal).toBe(tempEmail);
} else {
expect(currentVal).toBeDefined();
}
});

async function commitAllBtnClick() {
await showGitPanel();
if(!$(".check-all").prop("checked")) {
Expand Down

0 comments on commit e0d2a49

Please sign in to comment.