Skip to content

tests: checks if column is discovered and mapped correctly #422

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

Merged
merged 2 commits into from
Mar 9, 2020

Conversation

agnes512
Copy link
Contributor

@agnes512 agnes512 commented Mar 5, 2020

add a test case for Postgres for changes made in loopbackio/loopback-connector#171

  • checks if the id column name is demoId
  • checks if the instance can be generated properly with not-null id value

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • Commit messages are following our guidelines

},
};
Demo = db.createModel(demo_schema.name, demo_schema.properties, demo_schema.options);
Demo.destroyAll(done);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment. why create a model and then destroy all?

Copy link
Contributor Author

@agnes512 agnes512 Mar 5, 2020

Choose a reason for hiding this comment

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

db.createModel is to create model so that we can do CRUD operations. .destroyAll is to delete all instances. They are basic steps and used in many test files.

console.error(err);
done(err);
} else {
models.forEach(function(m) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why loop if there is only 1 model?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Match with other tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to not loop if it's only one model, even if it's inconsistent with the other tests, but it's not a big deal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

edited, thanks!

console.error(err);
done(err);
} else {
models.forEach(function(m) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to not loop if it's only one model, even if it's inconsistent with the other tests, but it's not a big deal.

@agnes512
Copy link
Contributor Author

agnes512 commented Mar 6, 2020

@slnode test please

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.

3 participants