@@ -23,15 +23,17 @@ test.describe('Multi Resource Route', () => {
2323 process . env [ 'SDK_E2E_DATASET_0' ] , // First dataset
2424 )
2525
26- // Create a player document in dataset 1
26+ // Create a movie document in dataset 1
2727 const {
28- documentIds : [ playerId ] ,
28+ documentIds : [ movieId ] ,
2929 } = await createDocuments (
3030 [
3131 {
32- _type : 'player' ,
33- name : 'Test Player Multi Resource' ,
34- slackUserId : 'U1234567890' ,
32+ _type : 'movie' ,
33+ title : 'Test Movie Multi Resource' ,
34+ tmdb_id : 123456 ,
35+ release_date : '2021-01-01' ,
36+ hosted_poster_path : 'https://example.com/poster.jpg' ,
3537 } ,
3638 ] ,
3739 { asDraft : false } , // Create as published document
@@ -45,16 +47,16 @@ test.describe('Multi Resource Route', () => {
4547
4648 // Wait for both document cards to be visible
4749 await expect ( pageContext . getByTestId ( / ^ a u t h o r - d o c u m e n t - / ) ) . toBeVisible ( )
48- await expect ( pageContext . getByTestId ( / ^ p l a y e r - d o c u m e n t - / ) ) . toBeVisible ( )
50+ await expect ( pageContext . getByTestId ( / ^ m o v i e - d o c u m e n t - / ) ) . toBeVisible ( )
4951
5052 // Verify author document content is displayed
5153 await expect ( pageContext . getByTestId ( 'author-name-display' ) ) . toHaveText (
5254 'Test Author Multi Resource' ,
5355 )
5456
55- // Verify player document content is displayed
56- await expect ( pageContext . getByTestId ( 'player -name-display' ) ) . toHaveText (
57- 'Test Player Multi Resource' ,
57+ // Verify movie document content is displayed
58+ await expect ( pageContext . getByTestId ( 'movie -name-display' ) ) . toHaveText (
59+ 'Test Movie Multi Resource' ,
5860 )
5961
6062 // Test author projection data
@@ -67,12 +69,14 @@ test.describe('Multi Resource Route', () => {
6769 'Best Code Award' ,
6870 )
6971
70- // Test player projection data
71- await expect ( pageContext . getByTestId ( 'player -projection-name' ) ) . toContainText (
72- 'Test Player Multi Resource' ,
72+ // Test movie projection data
73+ await expect ( pageContext . getByTestId ( 'movie -projection-name' ) ) . toContainText (
74+ 'Test Movie Multi Resource' ,
7375 )
74- await expect ( pageContext . getByTestId ( 'player-projection-slack-id' ) ) . toContainText ( 'U1234567890' )
75- await expect ( pageContext . getByTestId ( 'player-projection-has-slack' ) ) . toContainText ( 'Yes' )
76+ await expect ( pageContext . getByTestId ( 'movie-projection-release-date' ) ) . toContainText (
77+ '2021-01-01' ,
78+ )
79+ await expect ( pageContext . getByTestId ( 'movie-projection-has-poster' ) ) . toContainText ( 'Yes' )
7680
7781 // Test editing the author document
7882 const authorNameInput = pageContext . getByTestId ( 'author-name-input' )
@@ -87,26 +91,26 @@ test.describe('Multi Resource Route', () => {
8791 'Updated Author Name' ,
8892 )
8993
90- // Test editing the player document
91- const playerNameInput = pageContext . getByTestId ( 'player -name-input' )
92- await playerNameInput . fill ( 'Updated Player Name' )
93- await playerNameInput . press ( 'Enter' )
94+ // Test editing the movie document
95+ const movieNameInput = pageContext . getByTestId ( 'movie -name-input' )
96+ await movieNameInput . fill ( 'Updated Movie Name' )
97+ await movieNameInput . press ( 'Enter' )
9498
9599 // Verify the change is reflected in the display
96- await expect ( pageContext . getByTestId ( 'player -name-display' ) ) . toHaveText ( 'Updated Player Name' )
100+ await expect ( pageContext . getByTestId ( 'movie -name-display' ) ) . toHaveText ( 'Updated Movie Name' )
97101
98102 // Verify the change is also reflected in the projection
99- await expect ( pageContext . getByTestId ( 'player -projection-name' ) ) . toContainText (
100- 'Updated Player Name' ,
103+ await expect ( pageContext . getByTestId ( 'movie -projection-name' ) ) . toContainText (
104+ 'Updated Movie Name' ,
101105 )
102106
103107 // Test that external changes are reflected (simulating real-time updates)
104108 const authorClient = getClient ( process . env [ 'SDK_E2E_DATASET_0' ] )
105109 await authorClient . patch ( `drafts.${ authorId } ` ) . set ( { name : 'Externally Updated Author' } ) . commit ( )
106110
107- // Test external change for player
108- const playerClient = getClient ( process . env [ 'SDK_E2E_DATASET_1' ] )
109- await playerClient . patch ( `drafts.${ playerId } ` ) . set ( { name : 'Externally Updated Player ' } ) . commit ( )
111+ // Test external change for movie
112+ const movieClient = getClient ( process . env [ 'SDK_E2E_DATASET_1' ] )
113+ await movieClient . patch ( `drafts.${ movieId } ` ) . set ( { title : 'Externally Updated Movie ' } ) . commit ( )
110114
111115 // Verify external change is reflected
112116 await expect ( async ( ) => {
@@ -118,10 +122,10 @@ test.describe('Multi Resource Route', () => {
118122
119123 // Verify external change is reflected
120124 await expect ( async ( ) => {
121- const playerDisplay = await pageContext . getByTestId ( 'player -name-display' ) . textContent ( )
122- const playerProjection = await pageContext . getByTestId ( 'player -projection-name' ) . textContent ( )
123- expect ( playerDisplay ) . toBe ( 'Externally Updated Player ' )
124- expect ( playerProjection ) . toContain ( 'Externally Updated Player ' )
125+ const movieDisplay = await pageContext . getByTestId ( 'movie -name-display' ) . textContent ( )
126+ const movieProjection = await pageContext . getByTestId ( 'movie -projection-name' ) . textContent ( )
127+ expect ( movieDisplay ) . toBe ( 'Externally Updated Movie ' )
128+ expect ( movieProjection ) . toContain ( 'Externally Updated Movie ' )
125129 } ) . toPass ( { timeout : 5000 } )
126130 } )
127131} )
0 commit comments