Skip to content

Commit 92f65b3

Browse files
committed
fix: tests and createGuestbookDTO
1 parent 63ce2d8 commit 92f65b3

8 files changed

Lines changed: 6 additions & 17 deletions

File tree

docs/useCases.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,9 +2866,6 @@ const guestbook: CreateGuestbookDTO = {
28662866
nameRequired: true,
28672867
institutionRequired: false,
28682868
positionRequired: false,
2869-
email: 'test@gmail.com',
2870-
institution: 'Harvard University',
2871-
position: 'Researcher',
28722869
customQuestions: [
28732870
{
28742871
question: 'Describe yourself',
@@ -2898,6 +2895,7 @@ import { setGuestbookEnabled } from '@iqss/dataverse-client-javascript'
28982895

28992896
const collectionIdOrAlias = 'root'
29002897
const guestbookId = 123
2898+
const enabled = false
29012899

29022900
setGuestbookEnabled.execute(collectionIdOrAlias, guestbookId, false).then(() => {
29032901
/* ... */

src/access/domain/dtos/GuestbookResponseDTO.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export interface GuestbookResponseDTO {
99
email?: string
1010
institution?: string
1111
position?: string
12-
answers: GuestbookAnswerDTO[]
12+
answers?: GuestbookAnswerDTO[]
1313
}
1414
}

src/access/infra/repositories/AccessRepository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class AccessRepository extends ApiRepository implements IAccessRepository
2121
}
2222

2323
public async submitGuestbookForDatafilesDownload(
24-
fileIds: string | Array<number | string>,
24+
fileIds: Array<number>,
2525
guestbookResponse: GuestbookResponseDTO
2626
): Promise<string> {
2727
return this.doPost(

src/guestbooks/domain/dtos/CreateGuestbookDTO.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@ export interface CreateGuestbookDTO {
2121
nameRequired: boolean
2222
institutionRequired: boolean
2323
positionRequired: boolean
24-
email: string
25-
institution: string
26-
position: string
2724
customQuestions: CreateGuestbookCustomQuestionDTO[]
2825
}

src/guestbooks/domain/models/Guestbook.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ export interface Guestbook {
2222
nameRequired: boolean
2323
institutionRequired: boolean
2424
positionRequired: boolean
25-
email: string
26-
institution: string
27-
position: string
2825
customQuestions: GuestbookCustomQuestion[]
2926
createTime: string
3027
dataverseId: number

test/integration/access/AccessRepository.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ describe('AccessRepository', () => {
6767
const actual = await sut.submitGuestbookForDatafileDownload(testFileId, guestbookResponse)
6868

6969
expect(actual).toEqual(expect.any(String))
70+
expect(() => new URL(actual)).not.toThrow()
7071
})
7172

7273
test('should return error when datafile does not exist', async () => {
@@ -93,6 +94,7 @@ describe('AccessRepository', () => {
9394
guestbookResponse
9495
)
9596
expect(actual).toEqual(expect.any(String))
97+
expect(() => new URL(actual)).not.toThrow()
9698
})
9799

98100
test('should return error when dataset does not exist', async () => {
@@ -111,6 +113,7 @@ describe('AccessRepository', () => {
111113
guestbookResponse
112114
)
113115
expect(actual).toEqual(expect.any(String))
116+
expect(() => new URL(actual)).not.toThrow()
114117
})
115118

116119
test('should return error when dataset version does not exist', async () => {

test/integration/guestbooks/GuestbooksRepository.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ describe('GuestbooksRepository', () => {
2929
nameRequired: true,
3030
institutionRequired: false,
3131
positionRequired: false,
32-
email: 'test@gmail.com',
33-
institution: 'Harvard University',
34-
position: 'Researcher',
3532
customQuestions: [
3633
{
3734
question: "how's your day",

test/unit/guestbooks/CreateGuestbook.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ describe('CreateGuestbook', () => {
1111
nameRequired: true,
1212
institutionRequired: false,
1313
positionRequired: false,
14-
email: 'test@gmail.com',
15-
institution: 'Harvard University',
16-
position: 'Researcher',
1714
customQuestions: [
1815
{
1916
question: "how's your day",

0 commit comments

Comments
 (0)