-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve code quality based on SonarLint analysis
- Replace nanoid with uuid for better compatibility - Add proper error handling in auth service - Remove console.log statements from axios interceptors - Fix potential null reference issues - Add proper type annotations for error objects
- Loading branch information
Showing
9 changed files
with
68 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
import { logger } from "../index"; | ||
|
||
describe("logger", () => { | ||
let consoleLogSpy: jest.SpyInstance; | ||
|
||
beforeEach(() => { | ||
// console.log를 모킹하여 실제 콘솔 출력을 방지 | ||
consoleLogSpy = jest.spyOn(console, "log").mockImplementation(); | ||
}); | ||
|
||
afterEach(() => { | ||
// 각 테스트 후 모킹 초기화 | ||
consoleLogSpy.mockRestore(); | ||
}); | ||
|
||
it("should log message with correct format", () => { | ||
logger("Test message"); | ||
expect(consoleLogSpy).toHaveBeenCalledWith("[Logger] Test message", ""); | ||
}); | ||
|
||
it("should log message with data when provided", () => { | ||
const testData = { count: 1, text: "hello" }; | ||
logger("Test message", testData); | ||
expect(consoleLogSpy).toHaveBeenCalledWith( | ||
"[Logger] Test message", | ||
testData, | ||
); | ||
}); | ||
|
||
it("should handle undefined data correctly", () => { | ||
logger("Test message", undefined); | ||
expect(consoleLogSpy).toHaveBeenCalledWith("[Logger] Test message", ""); | ||
}); | ||
|
||
it("should handle multiple calls correctly", () => { | ||
logger("First message"); | ||
logger("Second message", { value: 123 }); | ||
|
||
expect(consoleLogSpy).toHaveBeenCalledTimes(2); | ||
expect(consoleLogSpy).toHaveBeenNthCalledWith( | ||
1, | ||
"[Logger] First message", | ||
"", | ||
); | ||
expect(consoleLogSpy).toHaveBeenNthCalledWith( | ||
2, | ||
"[Logger] Second message", | ||
{ value: 123 }, | ||
); | ||
}); | ||
let consoleLogSpy: jest.SpyInstance; | ||
|
||
beforeEach(() => { | ||
// console.log를 모킹하여 실제 콘솔 출력을 방지 | ||
consoleLogSpy = jest.spyOn(console, "log").mockImplementation(); | ||
}); | ||
|
||
afterEach(() => { | ||
// 각 테스트 후 모킹 초기화 | ||
consoleLogSpy.mockRestore(); | ||
}); | ||
|
||
it("should log message with correct format", () => { | ||
logger("Test message"); | ||
expect(consoleLogSpy).toHaveBeenCalledWith("[Logger] Test message", ""); | ||
}); | ||
|
||
it("should log message with data when provided", () => { | ||
const testData = { count: 1, text: "hello" }; | ||
logger("Test message", testData); | ||
expect(consoleLogSpy).toHaveBeenCalledWith( | ||
"[Logger] Test message", | ||
testData, | ||
); | ||
}); | ||
|
||
it("should handle undefined data correctly", () => { | ||
logger("Test message"); | ||
expect(consoleLogSpy).toHaveBeenCalledWith("[Logger] Test message", ""); | ||
}); | ||
|
||
it("should handle multiple calls correctly", () => { | ||
logger("First message"); | ||
logger("Second message", { value: 123 }); | ||
|
||
expect(consoleLogSpy).toHaveBeenCalledTimes(2); | ||
expect(consoleLogSpy).toHaveBeenNthCalledWith( | ||
1, | ||
"[Logger] First message", | ||
"", | ||
); | ||
expect(consoleLogSpy).toHaveBeenNthCalledWith( | ||
2, | ||
"[Logger] Second message", | ||
{ value: 123 }, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ export default function RootLayout({ | |
</body> | ||
</html> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters