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

[libs/movex] Add Specs to the MemoryMovexStore Specs to test the clearAll() functionality #46

Closed
GabrielCTroia opened this issue Oct 7, 2023 · 5 comments
Assignees
Labels
good first issue Good for newcomers hacktoberfest Improvements that qualify for Hacktoberfest

Comments

@GabrielCTroia
Copy link
Contributor

GabrielCTroia commented Oct 7, 2023

Where

libs/movex/src/lib/movex-store/MemoryMovexStore.spec.ts

What

Add tests to assert the "clearAll()" functionality - the clearAll() method

Why

To ensure the store works correctly

Definition of done

  • tests clearAll() with an empty store
  • tests any newly created items aren't there after clearAll()
  • tests clearAll() after items are updated
  • all other tests are still passing
@GabrielCTroia GabrielCTroia added good first issue Good for newcomers hacktoberfest Improvements that qualify for Hacktoberfest labels Oct 7, 2023
@RISHIKESHk07
Copy link

@GabrielCTroia Hey i would like to contribute , don't have much knowledge about the issue could you guide about it

@GabrielCTroia
Copy link
Contributor Author

Hi @RISHIKESHk07, sure!

So the clearAll() method simply removes all items in the store. Say, if you add 2 items and then call clearAll() the store should go back to being empty again!

Let me know if this makes sense! Thank you

@rohitverma007
Copy link

Added some tests but actually the last one fails, not sure if thats expected behaviour and the clearAll method might need change in functionality, happy to help fix it too:

  test('clearAll after multiple operations', async () => {
    const store = new MemoryMovexStore<{ counter: () => { count: number } }>();
    await store.create('counter:1', { count: 1 });
    await store.updateState('counter:1', (prev) => ({ count: prev.count + 1 }));
    await store.remove('counter:1');
    await store.create('counter:2', { count: 2 });
    await store.clearAll();
    expect(store.all()).toEqual({});
  });


@GabrielCTroia
Copy link
Contributor Author

Hey @rohitverma007, thank you for this! I just replied in the PR as well. Yes, if you'd like to you're more than welcome to work on the functionality as well!

Thank you 🙏

@GabrielCTroia
Copy link
Contributor Author

Closed in #188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest Improvements that qualify for Hacktoberfest
Projects
None yet
Development

No branches or pull requests

3 participants