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

feature: Add all resolvers unit tests #12 #55

Merged
merged 10 commits into from
Apr 19, 2020
Merged

feature: Add all resolvers unit tests #12 #55

merged 10 commits into from
Apr 19, 2020

Conversation

regevbr
Copy link
Contributor

@regevbr regevbr commented Apr 11, 2020

Fix #12

Changes:

  • add mutation testing using stryker (only runs on master as it takes very long time)
  • fixed commit linter
  • upload coverage reports from ci as artifacts so we can examine them if needed
  • updated all dependencies to latest versions
  • added support of specifying IOC bindings that can be used by tags or in multi inject
  • Added unit tests for db entities, to make sure the metadata is correct
  • added various loggings
  • Extracted the repository providers logic to an abstract class
  • Renamed flow.ts to dependencyChecker
  • Enhanced all CI revolvers to be more resilient, and added proper unit tests
  • Added a helper class to handle parsing NVM commands that can be used in CI configurations
  • Fixed target resolver to be able to handle more variations of node versions placeholders (like code names)
  • Various unit tests fixes to enhance coverage of mutation testings
  • Renamed lts.ts to nodeVersions as it can now handle more variations of node versions placeholders (like code names)
  • Changed unit tests framework to use extended-jest-mock which is typesafe
  • Added various test utilities
  • Moved tests that were in the unit tests directory to the integration tests directory, as they are not really unit tests
  • Use node 12 as the main node in CI as this is the node version being used in development
  • remove the usage of @injectable in interfaces as it is redundant - we only need injection in concrete classes
  • make the memoize decorator type safe

@regevbr regevbr self-assigned this Apr 11, 2020
@regevbr regevbr added the chore Make the code better label Apr 11, 2020
@regevbr regevbr requested a review from ynahmany April 11, 2020 19:38
@regevbr
Copy link
Contributor Author

regevbr commented Apr 11, 2020

@ynahmany this is a massive PR with 2 weeks works and I changed/added many features and touched many files.
This is definitely not how a PR should be, but I got crazy hahaha...

@codecov
Copy link

codecov bot commented Apr 11, 2020

Codecov Report

Merging #55 into master will increase coverage by 8.26%.
The diff coverage is 96.80%.

@@            Coverage Diff             @@
##           master      #55      +/-   ##
==========================================
+ Coverage   89.64%   97.90%   +8.26%     
==========================================
  Files          63       75      +12     
  Lines         792     1387     +595     
  Branches       67      164      +97     
==========================================
+ Hits          710     1358     +648     
+ Misses         82       29      -53     
Flag Coverage Δ
#unittest 97.90% <96.80%> (+8.26%) ⬆️
Impacted Files Coverage Δ
src/db/interfaces/IConnectionProvider.ts 100.00% <ø> (ø)
src/db/interfaces/IConnectionSettings.ts 100.00% <ø> (ø)
...solvers/cacheResolver/interfaces/ICacheResolver.ts 100.00% <ø> (ø)
src/resolvers/ciResolver/interfaces/ICIResolver.ts 100.00% <ø> (ø)
...lvers/ciResolver/interfaces/ISpecificCIResolver.ts 100.00% <ø> (ø)
.../resolvers/ciResolver/interfaces/ITargetMatcher.ts 100.00% <ø> (ø)
...ers/enginesResolver/interfaces/IEnginesResolver.ts 100.00% <ø> (ø)
...resolvers/testResolver/interfaces/ITestResolver.ts 100.00% <ø> (ø)
...c/utils/commandRunner/interfaces/ICommandRunner.ts 100.00% <ø> (ø)
src/utils/git/interfaces/IGitCheckout.ts 100.00% <ø> (ø)
... and 67 more

@regevbr regevbr added the pending code review pending code review label Apr 11, 2020
Copy link
Collaborator

@ynahmany ynahmany left a comment

Choose a reason for hiding this comment

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

finish the review.
most of the tests - I reviewed, but my CR there was not that effective.

src/db/entities/dependency.ts Show resolved Hide resolved
src/db/impl/AbstractRepositoryProvider.ts Show resolved Hide resolved
src/db/index.ts Outdated

export const EntitiesTags = {
dependencyVersion: Symbol.for(`DependencyVersion`),
dependency: Symbol.for(`Dependency`),
Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps Dependency.Name will work? not sure though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check, it might but I think it can cause a circular dependency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

src/resolvers/cacheResolver/impl/cacheResolver.ts Outdated Show resolved Hide resolved
src/resolvers/enginesResolver/impl/enginesResolver.ts Outdated Show resolved Hide resolved
propertyKey: TKey,
descriptor: TypedPropertyDescriptor<GenericFunction<A>>
): void => {
descriptor.value = memoizeFn(propertyKey, descriptor.value!, keyBuilder || defaultKeyBuilder);
Copy link
Collaborator

Choose a reason for hiding this comment

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

note for myself to speak with you about it.

@@ -1,4 +1,4 @@
import { BindingTypes, testBindings } from '../../../common/bindingTester';
import { BindingTypes, testBindings } from '../../../common/testers/bindingTester';
import { ITestResolver, testResolverModulesBinder } from '../../../../src/resolvers/testResolver';
import { TestResolver } from '../../../../src/resolvers/testResolver/impl/testResolver';

Copy link
Collaborator

Choose a reason for hiding this comment

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

there is only import and no export here..

Copy link
Contributor Author

@regevbr regevbr Apr 19, 2020

Choose a reason for hiding this comment

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

This is a test which invokes the testBindings method. No need to export anything.
Am I missing something?

Copy link
Collaborator

Choose a reason for hiding this comment

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

so there is no invokation what so ever?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is one just 1 line below

@regevbr
Copy link
Contributor Author

regevbr commented Apr 19, 2020

@ynahmany thanks for the review!
I fixed what I deemed necessary and commented on the rest

@regevbr regevbr merged commit 8c51e65 into master Apr 19, 2020
@regevbr regevbr deleted the #12 branch April 27, 2020 13:33
@regevbr regevbr removed the pending code review pending code review label May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Make the code better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: Add all resolvers unit tests
2 participants