Add use cases for Publish Dataset text settings#422
Add use cases for Publish Dataset text settings#422ekraffmiller wants to merge 6 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds client support for two Dataverse “info/settings” values needed to populate the Publish Dataset confirmation modal text (custom popup text + disclaimer text).
Changes:
- Extend
DataverseInfoRepository/IDataverseInfoRepositorywith getters for:DatasetPublishPopupCustomTextand:PublishDatasetDisclaimerText. - Add two new info-domain use cases to expose these settings to consumers of the package.
- Add/update unit + integration tests, docs, and changelog entries for the new functionality.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/info/DataverseInfoRepository.test.ts | Adds unit tests for the two new repository getters. |
| test/testHelpers/info/infoHelper.ts | Adds helper functions to set the new settings via the admin settings API in integration tests. |
| test/integration/info/DataverseInfoRepository.test.ts | Adds integration tests validating repository behavior when settings exist vs. don’t exist. |
| src/info/infra/repositories/DataverseInfoRepository.ts | Implements the two new settings getters via GET /info/settings/:.... |
| src/info/index.ts | Wires and exports new use case instances (currently has a wiring bug for disclaimer text). |
| src/info/domain/useCases/GetPublishDatasetDisclaimerText.ts | New use case wrapping getPublishDatasetDisclaimerText() repository call. |
| src/info/domain/useCases/GetDatasetPublishPopupCustomText.ts | New use case wrapping getDatasetPublishPopupCustomText() repository call. |
| src/info/domain/repositories/IDataverseInfoRepository.ts | Adds the two new repository method signatures. |
| docs/useCases.md | Documents the two new use cases (also touches an existing ContactDTO example line). |
| CHANGELOG.md | Adds changelog entries for the two new use cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export class GetDatasetPublishPopupCustomText implements UseCase<string> { | ||
| private dataverseInfoRepository: IDataverseInfoRepository | ||
|
|
||
| constructor(dataverseInfoRepository: IDataverseInfoRepository) { | ||
| this.dataverseInfoRepository = dataverseInfoRepository | ||
| } | ||
|
|
||
| /** | ||
| * Returns a string containing custom text for the Publish Dataset modal. | ||
| * | ||
| * @returns {Promise<string>} | ||
| */ | ||
| async execute(): Promise<string> { | ||
| return await this.dataverseInfoRepository.getDatasetPublishPopupCustomText() | ||
| } |
There was a problem hiding this comment.
This new use case doesn’t have a corresponding unit test under test/unit/info/ (other info use cases do). Add tests covering the success path (repository returns text) and error propagation (repository rejects).
src/info/index.ts
Outdated
| const getPublishDatasetDisclaimerText = new GetApplicationTermsOfUse(dataverseInfoRepository) | ||
| const getDatasetPublishPopupCustomText = new GetDatasetPublishPopupCustomText( | ||
| dataverseInfoRepository | ||
| ) |
There was a problem hiding this comment.
getPublishDatasetDisclaimerText is instantiated with GetApplicationTermsOfUse, so it will return the application terms instead of the publish disclaimer text. This also means the package export is incorrect for consumers. Instantiate GetPublishDatasetDisclaimerText here (and add the corresponding import) so getPublishDatasetDisclaimerText.execute() calls dataverseInfoRepository.getPublishDatasetDisclaimerText().
| export class GetPublishDatasetDisclaimerText implements UseCase<string> { | ||
| private dataverseInfoRepository: IDataverseInfoRepository | ||
|
|
||
| constructor(dataverseInfoRepository: IDataverseInfoRepository) { | ||
| this.dataverseInfoRepository = dataverseInfoRepository | ||
| } | ||
|
|
||
| /** | ||
| * Returns a string containing the disclaimer text for the Publish Dataset modal. | ||
| * | ||
| * @returns {Promise<string>} | ||
| */ | ||
| async execute(): Promise<string> { | ||
| return await this.dataverseInfoRepository.getPublishDatasetDisclaimerText() | ||
| } |
There was a problem hiding this comment.
This new use case doesn’t have a corresponding unit test under test/unit/info/ (other info use cases do). Add tests covering the success path (repository returns text) and error propagation (repository rejects).
There was a problem hiding this comment.
The tests are there in unit/info/DataversInfoRepository.test.ts, not sure why this comment was triggered.
fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…s://github.com/IQSS/dataverse-client-javascript into 407-add-use-cases-for-publish-dataset-settings
What this PR does / why we need it:
Adds use cases to get info settings from the Dataverse API, that are needed in the Publish Dataset confirmation modal.
Which issue(s) this PR closes:
Is there a release notes or changelog update needed for this change?:
in changelog.md
Additional documentation: