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

Refactor repository-tests to simplify the test case #4249

Closed
3 tasks
agnes512 opened this issue Dec 3, 2019 · 2 comments
Closed
3 tasks

Refactor repository-tests to simplify the test case #4249

agnes512 opened this issue Dec 3, 2019 · 2 comments

Comments

@agnes512
Copy link
Contributor

agnes512 commented Dec 3, 2019

Suggestion

follow up issue of #4148.

Currently, the acceptance tests in repository-tests are using shared fixtures to run tests on different databases.
A model might have several relations.
But then the test cases have to contain a lots of relevant attribute to make all databases pass.

Examples

For example, a expected test result in belongsTo-inclusion test file:

      const expected = [
        {
          ...thorOrder,
          isShipped: features.emptyValue,
          // eslint-disable-next-line @typescript-eslint/camelcase
          shipment_id: features.emptyValue,
          customer: {
            ...thor,
            parentId: features.emptyValue,
          },
        },
        {
          ...odinOrder,
          isShipped: features.emptyValue,
          // eslint-disable-next-line @typescript-eslint/camelcase
          shipment_id: features.emptyValue,
          customer: {
            ...odin,
            parentId: features.emptyValue,
          },
        },
      ];

parentId and is_shipped are redundant here.

Acceptance criteria

  • Clean up the fixtures. Remove those not being used properties ( such as is_shipped)
  • Should find a way that model classes were created dynamically by a factory function.

Stretch goal

  • Separate the relations in each models so that we only need the necessary properties when we test a certain relation. For example, now Customer hasMany Orders, hasMany Customers, belongsTo a Customer, and hasOne Address. These should be de-centered.
@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Dec 25, 2020
@stale
Copy link

stale bot commented Jul 14, 2021

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant