Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reach 100% coverage #22

Merged
merged 7 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [unreleased]

### 🧪 Testing

- Ensure if constructs are executing right to reach coverage of 100%

## [0.1.4] - 2024-09-06

### ⚙️ Miscellaneous Tasks
Expand Down
1 change: 1 addition & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ commit_preprocessors = [
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^docs: update changelog", skip = true },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 20 additions & 14 deletions spec/logger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,28 @@ describe('logger', () => {
}
)

it('should log a message at the specified level', () => {
interface Test {
logger: any
}
class Test {
hello() {
this.logger.debug('hello')
it.each(['verbose', 'debug', 'info', 'warn', 'error'])(
'should log a message at the specified level',
(level) => {
interface Test {
logger: any
}
class Test {
hello() {
this.logger[level]('hello')
}
}
}

loggerDecorator('test', { level: 'debug' })(Test)
const testInstance = new Test()
const consoleSpy = vi.spyOn(console, 'debug')
testInstance.hello()
expect(consoleSpy).toHaveBeenCalledOnce()
})
loggerDecorator('test', { level: level as any })(Test)
const testInstance = new Test()

let consoleSpy
if (level === 'verbose') consoleSpy = vi.spyOn(console, 'log')
else consoleSpy = vi.spyOn(console, level as any)
testInstance.hello()
expect(consoleSpy).toHaveBeenCalledOnce()
}
)

it('should not log a message at a lower level', () => {
interface Test {
Expand Down