Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Check property existence for exclude from indexes with wildcard (#…
…1114) * Add a test for testing without mocks Testing without mocks allows us to look at the code how it is functioning right now so that we can evaluate the intended behavior. * Do a refactor on the test Objects shared by both tests should be moved into the outer block so that they can be shared. * improve the test so that the error bubbles up Now the test fails properly and passes properly by introducing callbacks * isolate the latter test right now The failure should be visible to the user and in the current state it is so now by isolating the test it becomes easier to explore solutions that work. * test fixes indent a describe block, modify tests to make sure they pass and refactor a function out that easily allows for testing modified parameters. * Add two more tests for excludeFromIndexes on array Add two more tests that address the array case for excludeIndexesFromPath. Also ensure that the conditions which check for these test cases properly ignore exclude from indexes when an array is used * Move the tests over to the index file We should not create a nomocks file because we can just group the tests under a unique describe block of test/index.ts. * PR update Remove typeof and remove check for string ‘undefined’ * Create a function to refactor the tests Refactor the tests so that they are more readable. There is a lot of repeated code in each test which makes comparisons hard. * All tests for this feature now use same script Replace all tests exercising the feature so that they all use the same test script. This will make the tests way easier to read. * Add parameterized testing Add parameterized testing to eliminate repeated code. These tests need to be easier to read for the sake of the reviewer. * Eliminate function and inline code This function is only used once now. We should inline this code in the test. * Add JSON stringify to test title In the test title include the properties passed in so that it is easy to track what passed/failed. * Organize code so that similar variables are used Similar variables should be used together. Organize the code so that there is less confusion about which variables are related. * inline getExpectedConfig function The getExpectedConfig does not need to be used anymore because its code can just be inlined in the one place it is used. * Separate tests into blocks and inline code Separate the test into blocks and inline some parameters for better test readability. * Add types to parameters passed into async Stronger typing makes the code easier to read. * Eliminate unnecessary variable assignment Don’t assign to the Datastore variable. This is not necessary. Just use the OriginalDatastore variable directly. * Ran linter and simplified source changes The diff will be easier to read if we do not add a nested if statement and instead apply a condition on the if and change the else to else if. * Add blank line back for easier diff reading * Try again, eliminate the blank line * Additional adjustment to entity first path part Apply the first suggestion in the PR to all examples * Define isFirstPathPartUndefined There is a repeated code fragment for checking if the first path part is undefined that we should refactor. * Rename the variable to align with what it does * run linter * Revert "run linter" This reverts commit a101f27. * Revert "Rename the variable to align with what it does" This reverts commit 4f54d94. * Revert "Define isFirstPathPartUndefined" This reverts commit df3f376. * Refactor check out for seeing if defined We do four checks to see if the first path part is defined. We should refactor these checks out. * Move comment to more appropriate place The comment should reflect the next line of code. * Replace comments with description Replace comments with description property so that the tests will report the description when running the tests instead of the properties in the description. * Eliminate prefix. Only use description * fix typo * lowercase convention
- Loading branch information