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

fix #758 logger tests #759

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

susumutomita
Copy link

Description

This pull request fixes the logger test so that it no longer fails when importing LOG_LEVEL from logger.ts. Previously, there was a mismatch between LOG_LEVEL (a constant from @lit-protocol/constants) and LogLevel (an enum). This change ensures that both references can coexist, while favoring LOG_LEVEL for future compatibility.

Additionally, the test that checks creation timestamps (should order logs based on logger creation timestamp) has been corrected to compare loggerA.timestamp and loggerB.timestamp properly, instead of incorrectly matching a numeric timestamp against string IDs.

Related Issue:

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Locally:
    • Ran npx nx run logger:test --coverage and all tests passed without TypeScript errors.
    • Verified that LOG_LEVEL can be imported, and LogLevel still exists for backward compatibility.
❯ npx nx run logger:test --coverage
:
PASS   logger  packages/logger/src/lib/logger.spec.ts
  logger
    ✓ Log Manager singleton should be defined (1 ms)
    ✓ should make logger with category (1 ms)
    ✓ should make logger with id and category
    ✓ Log Manager should pass config to loggers
    ✓ Hashing enabled should filter non unique logs (17 ms)
    ✓ should respect info logging level (1 ms)
    ✓ should log error at any level
    ✓ should safe serialize circular references (1 ms)
    ✓ should trace logs through multiple categories (1 ms)
    ✓ should not persist logs if level set to OFF (5 ms)
    ✓ should persist logs across categories (1905 ms)
    ✓ should retain logger keys and return from LogManager (1 ms)
    ✓ should order logs based on logger creation timestamp (104 ms)

Test Suites: 1 passed, 1 total
Tests:       13 passed, 13 total
Snapshots:   0 total
Time:        2.856 s, estimated 5 s
Ran all test suites.
 
❯ yarn nx format:check --all                  
yarn run v1.22.22
$ /Users/susumu/js-sdk/node_modules/.bin/nx format:check --all
[warn] jsxBracketSameLine is deprecated.
✨  Done in 4.71s.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@susumutomita susumutomita requested a review from Ansonhkg as a code owner January 3, 2025 16:15
@CLAassistant
Copy link

CLAassistant commented Jan 3, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logger Tests Regression / Partial Reversion
3 participants