Skip to content

Commit

Permalink
fix: create only .code-workspace workspace file (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
slavik-lvovsky authored Oct 12, 2021
1 parent 07b254b commit d646d7a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/backend/.nycrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"extension": [".ts"],
"all": true,
"check-coverage": true,
"branches": 90,
"branches": 89,
"lines": 94,
"functions": 90,
"statements": 94
Expand Down
3 changes: 1 addition & 2 deletions packages/backend/src/utils/workspaceFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ class WorkspaceFileUtil {
}

private createWsFilePath(counter?: number): string {
const wsFileExt = Constants.IS_IN_BAS ? "theia-workspace" : "code-workspace";
const counterStr = counter ? `.${counter}.` : `.`;
return join(Constants.HOMEDIR_PROJECTS, `workspace${counterStr}${wsFileExt}`);
return join(Constants.HOMEDIR_PROJECTS, `workspace${counterStr}code-workspace`);
}

private getUniqWorkspaceFilePath(): string {
Expand Down
26 changes: 0 additions & 26 deletions packages/backend/test/utils/workspaceFile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,6 @@ describe("extension unit test", () => {
});

describe("createWorkspaceFile", () => {
it("is in BAS, workspace file does not exist", () => {
Constants.IS_IN_BAS = true;
const targetFolerPath = "targetFolerPath";
const expectedWsFilePath = join(Constants.HOMEDIR_PROJECTS, `workspace.theia-workspace`);
uriMock.expects("file").withArgs(expectedWsFilePath);
fsMock.expects("existsSync").withArgs(expectedWsFilePath).returns(false);
fsMock.expects("writeFileSync").withArgs(expectedWsFilePath);

WorkspaceFile.create(targetFolerPath);
});

it("is in BAS, workspace file exists", () => {
Constants.IS_IN_BAS = true;
const targetFolerPath = "targetFolerPath";

const existingWsFilePath = join(Constants.HOMEDIR_PROJECTS, `workspace.theia-workspace`);
fsMock.expects("existsSync").withArgs(existingWsFilePath).returns(true);

const expectedWsFilePath = join(Constants.HOMEDIR_PROJECTS, `workspace.1.theia-workspace`);
fsMock.expects("existsSync").withArgs(expectedWsFilePath).returns(false);
fsMock.expects("writeFileSync").withArgs(expectedWsFilePath);
uriMock.expects("file").withArgs(expectedWsFilePath);

WorkspaceFile.create(targetFolerPath);
});

it("is not in BAS, workspace file does not exist", () => {
Constants.IS_IN_BAS = false;
const targetFolerPath = "targetFolerPath";
Expand Down

0 comments on commit d646d7a

Please sign in to comment.