-
Notifications
You must be signed in to change notification settings - Fork 8
specify datasetType when creating a dataset #360
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,49 @@ describe('execute', () => { | |
expect(datasetsRepositoryStub.createDataset).toHaveBeenCalledWith( | ||
testDataset, | ||
testMetadataBlocks, | ||
ROOT_COLLECTION_ID | ||
ROOT_COLLECTION_ID, | ||
undefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could add an additional test to make sure datasetType would be called here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Added in 48cc5dc. Thanks for the help with this! |
||
) | ||
}) | ||
|
||
test('should return a dataset type', async () => { | ||
const testCreatedDatasetIdentifiers: CreatedDatasetIdentifiers = { | ||
persistentId: 'test', | ||
numericId: 1 | ||
} | ||
|
||
const datasetsRepositoryStub = <IDatasetsRepository>{} | ||
datasetsRepositoryStub.createDataset = jest | ||
.fn() | ||
.mockResolvedValue(testCreatedDatasetIdentifiers) | ||
|
||
const datasetValidatorStub = <ResourceValidator>{} | ||
datasetValidatorStub.validate = jest.fn().mockResolvedValue(undefined) | ||
|
||
const metadataBlocksRepositoryStub = <IMetadataBlocksRepository>{} | ||
metadataBlocksRepositoryStub.getMetadataBlockByName = jest | ||
.fn() | ||
.mockResolvedValue(testMetadataBlocks[0]) | ||
|
||
const sut = new CreateDataset( | ||
datasetsRepositoryStub, | ||
metadataBlocksRepositoryStub, | ||
datasetValidatorStub | ||
) | ||
|
||
const actual = await sut.execute(testDataset, ROOT_COLLECTION_ID, 'software') | ||
|
||
expect(actual).toEqual(testCreatedDatasetIdentifiers) | ||
|
||
expect(metadataBlocksRepositoryStub.getMetadataBlockByName).toHaveBeenCalledWith( | ||
testMetadataBlocks[0].name | ||
) | ||
expect(datasetValidatorStub.validate).toHaveBeenCalledWith(testDataset, testMetadataBlocks) | ||
expect(datasetsRepositoryStub.createDataset).toHaveBeenCalledWith( | ||
testDataset, | ||
testMetadataBlocks, | ||
ROOT_COLLECTION_ID, | ||
'software' | ||
) | ||
}) | ||
|
||
|
@@ -111,7 +153,8 @@ describe('execute', () => { | |
expect(datasetsRepositoryStub.createDataset).toHaveBeenCalledWith( | ||
testDataset, | ||
testMetadataBlocks, | ||
ROOT_COLLECTION_ID | ||
ROOT_COLLECTION_ID, | ||
undefined | ||
) | ||
}) | ||
|
||
|
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.
Could you add the param to the description above @param {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.
Sure, added in 156963d.