Skip to content

Commit

Permalink
chore: remove extra check if .scss file does exist
Browse files Browse the repository at this point in the history
Remove an extra check within the removeScssTypeFile to avoid
removing a type file if the .scss file stil exists. This function
will assume the .scss file is already remove before proceeding to
remove the type file definition. In addition, this commits
removes the unit test that tested the functionality of not removing
existing .scss files.
  • Loading branch information
ccortezaguilera authored and skovy committed Oct 28, 2020
1 parent b44ffd9 commit 62703c0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
12 changes: 0 additions & 12 deletions __tests__/core/remove-file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ describe("removeFile", () => {
afterEach(() => {
jest.clearAllMocks();
});
it("does nothing if *.scss file style exists", async () => {
const existsSyncSpy = fs.existsSync;
const unlinkSyncSpy = fs.unlinkSync;
const existingTypes = getTypeDefinitionPath(existingFile);
removeSCSSTypeDefinitionFile(existingFile);
expect(existsSyncSpy).toBeCalledWith(expect.stringMatching(existingFile));
expect(existsSyncSpy).not.toBeCalledWith(
expect.stringMatching(existingTypes)
);
expect(unlinkSyncSpy).not.toBeCalled();
expect(alerts.success).not.toBeCalled();
});
it("does nothing if types file doesn't exist", async () => {
const existsSyncSpy = fs.existsSync;
const unlinkSyncSpy = fs.unlinkSync;
Expand Down
3 changes: 0 additions & 3 deletions lib/core/remove-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ const removeFile = (file: string): void => {
* @param file the SCSS file to generate types for
*/
export const removeSCSSTypeDefinitionFile = (file: string): void => {
if (fs.existsSync(file)) {
return;
}
const path = getTypeDefinitionPath(file);
removeFile(path);
};

0 comments on commit 62703c0

Please sign in to comment.