Skip to content

Commit

Permalink
Merge pull request #22 from devsheva/develop
Browse files Browse the repository at this point in the history
feat: reach 100% coverage
  • Loading branch information
devsheva authored Sep 10, 2024
2 parents de9dbc7 + e4013c6 commit 99658b8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
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
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

0 comments on commit 99658b8

Please sign in to comment.