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

chore: cleanup review #51

Closed
wants to merge 6 commits into from
Closed

chore: cleanup review #51

wants to merge 6 commits into from

Conversation

RealShadowNova
Copy link
Member

@RealShadowNova RealShadowNova commented Mar 4, 2022

This PR includes a workspace wide review. Many changes were made.

Changes

  • Add resolveCommonIdentifiers() function.
  • Change Josh#error() and JoshProvider#error() to utilize resolveCommonIdentifiers()
  • Move Josh#isPayloadWithData() method to a separate function.
  • Add missing checks.
  • Remove unused checks.
  • Rename Josh#getKeyPath() to Josh#resolveKeyPath()
  • Rename Josh#getPath() to Josh#resolvePath()
  • Add Josh#resolveIdentifier()
  • Add more detailed documentation to JoshProvider to help ensure all providers behave the same.
  • Move Josh.CommonIdentifiers enum to a separate file.
  • Remove Value generic type from Payloads.SetMany since this only added issues when actually using the method forcing all values to be the same.
  • Remove path property from Payloads.Update
  • Rewrite MapProvider
  • Rewrite MapProvider tests
  • Add proper tests for Josh
  • Refactor middleware context data and how it's handled.

src/lib/functions/resolveCommonIdentifier.ts Outdated Show resolved Hide resolved
src/lib/structures/Josh.ts Show resolved Hide resolved
names: string[],
options: Omit<Josh.Options, 'name'> = {}
): Instances {
public static multi<Instances extends Record<string, Josh> = Record<string, Josh>>(names: string[], options: Josh.Options = {}): Instances {
const instances: Record<string, Josh> = {};

for (const [name, instance] of names.map((name) => [name, new Josh({ ...options, name })]) as [string, Josh][]) instances[name] = instance;
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a provider test to make sure multiple josh instances doesn't fail

Copy link
Member Author

Choose a reason for hiding this comment

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

wdym?

Copy link
Member

Choose a reason for hiding this comment

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

So like a test in providers that just boots two with different names and makes sure the same named key with different values does return correctly

src/lib/structures/JoshProvider.ts Outdated Show resolved Hide resolved
src/lib/structures/JoshProvider.ts Outdated Show resolved Hide resolved
@dan-online
Copy link
Member

Also issues in the unit tests

@RealShadowNova
Copy link
Member Author

RealShadowNova commented Mar 5, 2022

Also issues in the unit tests

Yep, that's why it's in the todo to rewrite those.

@RealShadowNova
Copy link
Member Author

This PR is being closed and then being split into multiple PRs due to it's size and clutter.

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.

None yet

2 participants