Skip to content

Conversation

@seslatero
Copy link

Found reference to having defaultValue defined in the docs, but it isn't actually in the code (and I thought it'd be good to use).

I figured it should be fairly straightforward to implement, so I've had a go. The only thing I'm not clear about is whether having a defaultValue defined means the type is nullable? I think they are independent still, so I've left isNullable alone.

Hopefully I haven't missed anything, I haven't made an effort to try and understand the whole codebase, just the bits I was interested in.

@codecov
Copy link

codecov bot commented Jul 11, 2018

Codecov Report

Merging #53 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #53   +/-   ##
=======================================
  Coverage   87.44%   87.44%           
=======================================
  Files          61       61           
  Lines        1107     1107           
  Branches      194      194           
=======================================
  Hits          968      968           
  Misses        138      138           
  Partials        1        1
Impacted Files Coverage Δ
src/domains/arg/options.ts 100% <ø> (ø) ⬆️
src/domains/arg/compiler.ts 90.16% <ø> (ø) ⬆️
src/domains/arg/registry.ts 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1827de8...ddc0c3b. Read the comment docs.

});

it('Will allow registering argument at runtime', () => {
@ObjectType()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test should keep focusing only on registering args at runtime. Having default values tested here pollutes this test

Copy link
Author

Choose a reason for hiding this comment

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

yeah I agree, I haven't actually changed this test at all, I have no idea why github has decided to render the diff like this, my own tools don't. Though it does look like something autoformatted the parameter block (line 97), maybe that's it.

return baz;
}
}
const compiledObject = compileObjectType(Foo);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be good to test it basing on resolving some field that is based on knowing default value.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah I couldn't think of a way to do this, maybe defining a schema in the test, compiling it and executing against it?

Copy link
Author

Choose a reason for hiding this comment

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

Added such a condition, I hope async/await is OK, seemed the easiest way to do it.

Reverted format change to pre-existing test
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.

2 participants