-
Notifications
You must be signed in to change notification settings - Fork 7
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
MMT-3409: publishDraft mutation for Collection/Service/Tool drafts, deleteTool mutation #73
Conversation
|
||
expect(draft.ingestPath).toEqual('providers/EDSC/bad-drafts') | ||
expect(draft.publishPath).toEqual('publish/CD100000-EDSC') | ||
expect(draft.metadataSpecification).toEqual({ |
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.
Seems like this should throw an error instead of return bad data... Is the idea here that we send this to CMR and let them report the issue?
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.
Its really unreachable code. The conceptType in that switch statement is based off a graphql enum type, but I didn't want to write a ton of if statements so I wrote a switch. eslint expects a default case so this test handles the default. I can change it to throw an error, but it is still something we wouldn't see
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.
Seeing all the tests I broke when I changed it to throw an error. When we call publishDraft it still uses this class, but conceptType is unimportant, so I just passed in Draft
, which hits the default case in the switch. But the metadataSpecification isn't used when publishing a draft
|
||
import { pickIgnoringCase } from '../../utils/pickIgnoringCase' | ||
import Concept from './concept' | ||
import { mergeParams } from '../../utils/mergeParams' |
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.
Clean up import order :)
src/cmr/concepts/draft.js
Outdated
const { | ||
providerId, | ||
ummVersion | ||
draftConceptId = '', |
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.
This feels like a required field, what is the purpose of defaulting it to an empty string versus throwing an error?
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 think the empty string came from an earlier attempt to work this where I was performing some action on the string, not needed anymore
let ummType | ||
let ummName | ||
let ummVersion | ||
switch (conceptType) { |
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.
Can't the sub classes just set/return these values instead of having a switch statement in the parent?
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 are no sub classes
src/cmr/concepts/draft.js
Outdated
publish(data, requestedKeys, providedHeaders) { | ||
const { ummVersion } = data | ||
|
||
// eslint-disable-next-line no-param-reassign |
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 see this 6 times in the repo -- wouldn't it be better to create a new const
and remove the eslint-disable
?
|
||
process.env = { ...OLD_ENV } | ||
|
||
process.env.cmrRootUrl = 'http://example.com' |
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've been trying to be more specific in the URLs in tests to indicate what service its calling, example-cmr
in this case -- it makes the testing a bit more specific and easier to read.
src/types/tool.graphql
Outdated
|
||
type ToolMutationResponse { | ||
"The unique concept id assigned to the tool." | ||
conceptId: 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.
This is required in other types, should it be required here?
src/types/tool.graphql
Outdated
"The unique concept id assigned to the tool." | ||
conceptId: String | ||
"The revision of the tool." | ||
revisionId: 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.
This is required in other types, should it be required here?
1ab3ea5
to
c233749
Compare
Codecov Report
@@ Coverage Diff @@
## main #73 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 69 69
Lines 1446 1503 +57
Branches 202 208 +6
=========================================
+ Hits 1446 1503 +57
|
Overview
What is the feature?
Adds publishDraft mutation to publish Collection/Service/Tool drafts.
Adds deleteTool mutation to delete Tools
What areas of the application does this impact?
Publishing drafts, deleting tools
Testing
Publishing a draft (needs a valid draft in CMR to publish)
variables:
Deleting a Tool
variables:
Checklist