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

Add reset and del functionality #144

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

samirsilwal
Copy link
Contributor

@samirsilwal samirsilwal commented Oct 6, 2024

Changes

  • Add reset function to purge the store. It helps to clear out the store once the use is completed
  • It also deletes a specific key in the store. It can be used to reset a specific key
  • Updated tests and readme with the changes

@samirsilwal
Copy link
Contributor Author

Some issue with codecov package 🤷 which breaks the CI

@mesaugat
Copy link
Member

@samirsilwal Need to do the same here for codecov. Thanks! 😄

@samirsilwal
Copy link
Contributor Author

@samirsilwal Need to do the same here for codecov. Thanks! 😄

Cool will create a PR

src/AsyncStore.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link

codecov bot commented Oct 20, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 84.43%. Comparing base (5e6b77d) to head (db0e90f).

Files with missing lines Patch % Lines
src/impl/domain.ts 50.00% 4 Missing and 1 partial ⚠️
src/index.ts 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #144      +/-   ##
==========================================
- Coverage   87.75%   84.43%   -3.33%     
==========================================
  Files           5        5              
  Lines         147      167      +20     
  Branches       25       28       +3     
==========================================
+ Hits          129      141      +12     
- Misses         15       21       +6     
- Partials        3        5       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mesaugat
Copy link
Member

@samirsilwal I haven't checked but seems like codecov is not happy because we didn't cover some lines that were added. Did you check?

@mesaugat mesaugat changed the title Fix test for the added reset function Add reset and del functionality Nov 1, 2024
Comment on lines +16 to +17
reset: () => void;
del: (key: string) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samirsilwal Please update the README as well.

expect(globalStore.get('foo')).to.equal('foo');
expect(globalStore.get('bar')).to.equal('bar');

expect(globalStore.del.bind(globalStore, 'baz')).to.not.throw('Async store not initialized.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this expect here as you have a separate test if the store is not initialized.

});

it('should do nothing if the store is not initialized.', () => {
expect(globalStore.del.bind(globalStore, 'foo')).to.throw('Async store not initialized.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, why do we need to .bind here?

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

Successfully merging this pull request may close these issues.

2 participants