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

feat: entity mutation validators #67

Merged
merged 3 commits into from
Jul 23, 2020
Merged

Conversation

quinlanj
Copy link
Member

@quinlanj quinlanj commented Jul 23, 2020

Why

Implements validation for entity mutations. Validators are specified by the user, and run before every create and update mutation. Validators are run before any triggers.

#25

Tests

  • new unit tests pass (verifying validator call counts on different mutation operations)
  • new integration tests pass (verifying validators work as expected inside a txn)

@quinlanj quinlanj requested a review from wschurman July 23, 2020 01:00
@codecov
Copy link

codecov bot commented Jul 23, 2020

Codecov Report

Merging #67 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   94.55%   94.57%   +0.02%     
==========================================
  Files          59       59              
  Lines        1488     1494       +6     
  Branches      165      166       +1     
==========================================
+ Hits         1407     1413       +6     
  Misses         79       79              
  Partials        2        2              
Flag Coverage Δ
#integration 94.57% <100.00%> (+0.02%) ⬆️
#unittest 94.57% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/entity/src/EntityCompanion.ts 100.00% <ø> (ø)
packages/entity/src/EntityCompanionProvider.ts 100.00% <100.00%> (ø)
packages/entity/src/EntityMutator.ts 98.02% <100.00%> (+0.03%) ⬆️
packages/entity/src/EntityMutatorFactory.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd6060c...c518bac. Read the comment docs.

@wschurman wschurman changed the title (feat) entity mutation validators feat: entity mutation validators Jul 23, 2020
Copy link
Member

@wschurman wschurman left a comment

Choose a reason for hiding this comment

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

We'll probably only want to run these on create and update, so that's what makes me think that there should probably just be one set of validators (see inline comment).

packages/entity/src/EntityMutationTrigger.ts Outdated Show resolved Hide resolved
packages/entity/src/__tests__/EntityMutator-test.ts Outdated Show resolved Hide resolved
@quinlanj quinlanj requested a review from wschurman July 23, 2020 01:42
Copy link
Member

@wschurman wschurman left a comment

Choose a reason for hiding this comment

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

LGTM. Just add some test (as mentioned in summary) and convert the PR to non-draft and I'll review more thoroughly.

@quinlanj quinlanj marked this pull request as ready for review July 23, 2020 07:59
@quinlanj quinlanj requested a review from wschurman July 23, 2020 07:59
Copy link
Member

@wschurman wschurman left a comment

Choose a reason for hiding this comment

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

Before landing, update the summary (remove TODOs, detail behavior slightly more). Other than that, looks great. I'll probably rename EntityMutationTrigger to something else in a follow-up PR.

@quinlanj quinlanj merged commit fc4377d into master Jul 23, 2020
@quinlanj quinlanj deleted the @quin/entityMutationValidators branch July 23, 2020 18:03
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