-
Notifications
You must be signed in to change notification settings - Fork 31
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/dynamic tests #57
Conversation
…ntities dynamically
fix schema variable name typo #57
Hi @italojs could you resolve the conflicts here? |
@dalssoft could you finish your review, please? |
bug: the tests files are created on |
│ ├── createUser.test.js | ||
│ ├── deleteUser.js | ||
│ ├── deleteUser.test.js | ||
│ ├── deleteUser.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't think it make any sense to put the dir tree in the doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not? I explains what is the final result that CLI generate, it's super explainable
/*{ <%= props.request %> }*/ | ||
const req = { nickname: 'herbsUser', password: 'V&eryStr0ngP@$$'} | ||
|
||
const req = <%- props.request.valid %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generated value has multi lines and does not respect the spaces / tabs from the template.
Ex:
}
const req = {
nickname: 'string',
password: 'string'
}
// When
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking to resolve it after resolve this issue #14, so the linter will fix it for us
|
||
it('should not delete the invalid <%= props.name.pascalCase %>', async () => { | ||
// Given | ||
const injection = {} | ||
const user = aUser({ hasAccess: true }) | ||
/*{ <%= props.request %> }*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug:
/*{ [object Object] }*/
const req = { id : '5' }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, could you explains a little bit more about the bug?
const useCases = Object.keys(validUseCaseRequests) | ||
|
||
const valueType = { | ||
String: "'string'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: a text
, intead of string
const ret = await uc.run(req) | ||
|
||
// Then | ||
assert.ok(ret.isOk) | ||
assert.strictEqual(ret.ok.nickname, 'herbsUser') | ||
assert.strictEqual(ret.ok.isValid(), true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.strictEqual(ret.ok.isValid(), true)
this assertion does not belong to this scenario (and all other tests with the same assertion) given that this test scenario test for UC running ok, not if the returned entity is valid
function aUser({ hasAccess }) { | ||
return { hasAccess } | ||
} | ||
describe('Find one <%= props.name.raw %>', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a test to cover the scenario form if (!result) return Err.notFound({
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
function aUser({ hasAccess }) { | ||
return { hasAccess } | ||
} | ||
describe('Update <%= props.name.raw %>', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a test for if (!ctx.user.isValid()) return Err.invalidEntity({
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will need to be implemented in the future because the if (!ctx.user.isValid()) return Err.invalidEntity({
validation is applied for entities that has fields validation, this PR don't contemplate it.
🎉 This PR is included in version 1.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #52
Proposed Changes
example/my-custom-entities
toexample-entities
new
folderReadiness Checklist
Author/Contributor
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance