@@ -40,7 +40,7 @@ describe('ReleaseApiDataSetVersionHistoryPage', () => {
40
40
} ,
41
41
published : '2024-04-01' ,
42
42
releaseVersion : {
43
- id : 'release-version-3 -1-id' ,
43
+ id : 'release-v3 -1-id' ,
44
44
title : 'Release version 3.1' ,
45
45
} ,
46
46
status : 'Published' ,
@@ -55,7 +55,7 @@ describe('ReleaseApiDataSetVersionHistoryPage', () => {
55
55
} ,
56
56
published : '2024-03-01' ,
57
57
releaseVersion : {
58
- id : 'release-version-3 -id' ,
58
+ id : 'release-v3 -id' ,
59
59
title : 'Release version 3' ,
60
60
} ,
61
61
status : 'Published' ,
@@ -70,7 +70,7 @@ describe('ReleaseApiDataSetVersionHistoryPage', () => {
70
70
} ,
71
71
published : '2024-02-01' ,
72
72
releaseVersion : {
73
- id : 'release-version-2 -id' ,
73
+ id : 'release-v2 -id' ,
74
74
title : 'Release version 2' ,
75
75
} ,
76
76
status : 'Published' ,
@@ -85,7 +85,7 @@ describe('ReleaseApiDataSetVersionHistoryPage', () => {
85
85
} ,
86
86
published : '2024-01-01' ,
87
87
releaseVersion : {
88
- id : 'release-version-1 -id' ,
88
+ id : 'release-v1 -id' ,
89
89
title : 'Release version 1' ,
90
90
} ,
91
91
status : 'Published' ,
@@ -109,6 +109,8 @@ describe('ReleaseApiDataSetVersionHistoryPage', () => {
109
109
110
110
expect ( await screen . findByText ( 'Data set title' ) ) . toBeInTheDocument ( ) ;
111
111
112
+ const { publicationId } = testRelease ;
113
+
112
114
const rows = within ( screen . getByRole ( 'table' ) ) . getAllByRole ( 'row' ) ;
113
115
expect ( rows ) . toHaveLength ( 5 ) ;
114
116
@@ -118,68 +120,86 @@ describe('ReleaseApiDataSetVersionHistoryPage', () => {
118
120
within ( row1Cells [ 1 ] ) . getByRole ( 'link' , { name : 'Release version 3.1' } ) ,
119
121
) . toHaveAttribute (
120
122
'href' ,
121
- `/publication/${ testRelease . publicationId } /release/release-version-3 -1-id/summary` ,
123
+ `/publication/${ publicationId } /release/release-v3 -1-id/summary` ,
122
124
) ;
123
125
expect ( row1Cells [ 2 ] ) . toHaveTextContent ( 'Published' ) ;
124
126
expect ( row1Cells [ 2 ] ) . toHaveTextContent ( 'Latest version' ) ;
125
127
expect (
126
128
within ( row1Cells [ 3 ] ) . getByRole ( 'link' , {
127
129
name : 'View changelog for version 3.1' ,
128
130
} ) ,
129
- ) . toBeInTheDocument ( ) ;
131
+ ) . toHaveAttribute (
132
+ 'href' ,
133
+ `/publication/${ publicationId } /release/release-v3-1-id/api-data-sets/data-set-id/changelog/version-3-1-id` ,
134
+ ) ;
130
135
expect (
131
136
within ( row1Cells [ 3 ] ) . getByRole ( 'link' , {
132
- name : ' View live data set for version 3.1 (opens in new tab)' ,
137
+ name : / V i e w l i v e d a t a s e t f o r v e r s i o n 3 .1 / ,
133
138
} ) ,
134
- ) . toBeInTheDocument ( ) ;
139
+ ) . toHaveAttribute (
140
+ 'href' ,
141
+ 'http://localhost/data-catalogue/data-set/version-3-1-file-id' ,
142
+ ) ;
135
143
136
144
const row2Cells = within ( rows [ 2 ] ) . getAllByRole ( 'cell' ) ;
137
145
expect ( row2Cells [ 0 ] ) . toHaveTextContent ( '3.0' ) ;
138
146
expect (
139
147
within ( row2Cells [ 1 ] ) . getByRole ( 'link' , { name : 'Release version 3' } ) ,
140
148
) . toHaveAttribute (
141
149
'href' ,
142
- `/publication/${ testRelease . publicationId } /release/release-version-3 -id/summary` ,
150
+ `/publication/${ publicationId } /release/release-v3 -id/summary` ,
143
151
) ;
144
152
expect ( row2Cells [ 2 ] ) . toHaveTextContent ( 'Published' ) ;
145
153
expect (
146
154
within ( row2Cells [ 3 ] ) . getByRole ( 'link' , {
147
155
name : 'View changelog for version 3.0' ,
148
156
} ) ,
149
- ) . toBeInTheDocument ( ) ;
157
+ ) . toHaveAttribute (
158
+ 'href' ,
159
+ `/publication/${ publicationId } /release/release-v3-id/api-data-sets/data-set-id/changelog/version-3-id` ,
160
+ ) ;
150
161
expect (
151
162
within ( row2Cells [ 3 ] ) . getByRole ( 'link' , {
152
- name : ' View live data set for version 3.0 (opens in new tab)' ,
163
+ name : / V i e w l i v e d a t a s e t f o r v e r s i o n 3 .0 / ,
153
164
} ) ,
154
- ) . toBeInTheDocument ( ) ;
165
+ ) . toHaveAttribute (
166
+ 'href' ,
167
+ 'http://localhost/data-catalogue/data-set/version-3-file-id' ,
168
+ ) ;
155
169
156
170
const row3Cells = within ( rows [ 3 ] ) . getAllByRole ( 'cell' ) ;
157
171
expect ( row3Cells [ 0 ] ) . toHaveTextContent ( '2.0' ) ;
158
172
expect (
159
173
within ( row3Cells [ 1 ] ) . getByRole ( 'link' , { name : 'Release version 2' } ) ,
160
174
) . toHaveAttribute (
161
175
'href' ,
162
- `/publication/${ testRelease . publicationId } /release/release-version-2 -id/summary` ,
176
+ `/publication/${ publicationId } /release/release-v2 -id/summary` ,
163
177
) ;
164
178
expect ( row3Cells [ 2 ] ) . toHaveTextContent ( 'Published' ) ;
165
179
expect (
166
180
within ( row3Cells [ 3 ] ) . getByRole ( 'link' , {
167
181
name : 'View changelog for version 2.0' ,
168
182
} ) ,
169
- ) . toBeInTheDocument ( ) ;
183
+ ) . toHaveAttribute (
184
+ 'href' ,
185
+ `/publication/${ publicationId } /release/release-v2-id/api-data-sets/data-set-id/changelog/version-2-id` ,
186
+ ) ;
170
187
expect (
171
188
within ( row3Cells [ 3 ] ) . getByRole ( 'link' , {
172
- name : ' View live data set for version 2.0 (opens in new tab)' ,
189
+ name : / V i e w l i v e d a t a s e t f o r v e r s i o n 2 .0 / ,
173
190
} ) ,
174
- ) . toBeInTheDocument ( ) ;
191
+ ) . toHaveAttribute (
192
+ 'href' ,
193
+ 'http://localhost/data-catalogue/data-set/version-2-file-id' ,
194
+ ) ;
175
195
176
196
const row4Cells = within ( rows [ 4 ] ) . getAllByRole ( 'cell' ) ;
177
197
expect ( row4Cells [ 0 ] ) . toHaveTextContent ( '1.0' ) ;
178
198
expect (
179
199
within ( row4Cells [ 1 ] ) . getByRole ( 'link' , { name : 'Release version 1' } ) ,
180
200
) . toHaveAttribute (
181
201
'href' ,
182
- `/publication/${ testRelease . publicationId } /release/release-version-1 -id/summary` ,
202
+ `/publication/${ publicationId } /release/release-v1 -id/summary` ,
183
203
) ;
184
204
expect ( row4Cells [ 2 ] ) . toHaveTextContent ( 'Published' ) ;
185
205
expect (
@@ -189,12 +209,15 @@ describe('ReleaseApiDataSetVersionHistoryPage', () => {
189
209
) . not . toBeInTheDocument ( ) ;
190
210
expect (
191
211
within ( row4Cells [ 3 ] ) . getByRole ( 'link' , {
192
- name : ' View live data set for version 1.0 (opens in new tab)' ,
212
+ name : / V i e w l i v e d a t a s e t f o r v e r s i o n 1 .0 / ,
193
213
} ) ,
194
- ) . toBeInTheDocument ( ) ;
214
+ ) . toHaveAttribute (
215
+ 'href' ,
216
+ 'http://localhost/data-catalogue/data-set/version-1-file-id' ,
217
+ ) ;
195
218
} ) ;
196
219
197
- test ( 'pagination' , async ( ) => {
220
+ test ( 'pagination works correctly ' , async ( ) => {
198
221
apiDataSetService . getDataSet . mockResolvedValue ( testDataSet ) ;
199
222
apiDataSetVersionService . listVersions . mockResolvedValueOnce ( {
200
223
results : [ testVersions [ 0 ] , testVersions [ 1 ] ] ,
0 commit comments