@@ -886,6 +886,20 @@ describe('Semrush REST transport', () => {
886886 const [ url , init ] = fetchStub . firstCall . args ;
887887 expect ( init . method ) . to . equal ( 'POST' ) ;
888888 expect ( url ) . to . equal (
889+ `https://adobe-hackathon.semrush.com/apis/v4-raw/external-api/v1/workspaces/${ WORKSPACE_ID } /products/ai/elements/elem-42` ,
890+ ) ;
891+ expect ( JSON . parse ( init . body ) ) . to . deep . equal ( { render_data : renderData } ) ;
892+ expect ( result . data . rows [ 0 ] . prompt ) . to . equal ( 'hello' ) ;
893+ } ) ;
894+
895+ it ( 'throws SerenityTransportError on upstream 4xx' , async ( ) => {
896+ fetchStub . resolves ( fetchFail ( 403 , { message : 'forbidden' } ) ) ;
897+ const transport = createSerenityTransport ( { env : TEST_ENV , imsToken : IMS } ) ;
898+
899+ const promise = transport . queryBrandPresenceResults ( WORKSPACE_ID , 'elem-42' , { } ) ;
900+ await expect ( promise ) . to . be . rejectedWith ( SerenityTransportError ) ;
901+ } ) ;
902+ } ) ;
889903
890904 describe ( 'getBrandTopics' , ( ) => {
891905 it ( 'GETs /v1/workspaces/{ws}/brand-topics with domain + country query' , async ( ) => {
@@ -1202,19 +1216,6 @@ describe('Semrush REST transport', () => {
12021216 expect ( params . get ( 'domain' ) ) . to . equal ( '' ) ;
12031217 expect ( params . get ( 'country' ) ) . to . equal ( '' ) ;
12041218 } ) ;
1205- = === ===
1206- `https://adobe-hackathon.semrush.com/apis/v4-raw/external-api/v1/workspaces/${ WORKSPACE_ID } /products/ai/elements/elem-42` ,
1207- ) ;
1208- expect ( JSON . parse ( init . body ) ) . to . deep . equal ( { render_data : renderData } ) ;
1209- expect ( result . data . rows [ 0 ] . prompt ) . to . equal ( 'hello' ) ;
1210- } ) ;
1211-
1212- it ( 'throws SerenityTransportError on upstream 4xx' , async ( ) => {
1213- fetchStub . resolves ( fetchFail ( 403 , { message : 'forbidden' } ) ) ;
1214- const transport = createSerenityTransport ( { env : TEST_ENV , imsToken : IMS } ) ;
1215-
1216- const promise = transport . queryBrandPresenceResults ( WORKSPACE_ID , 'elem-42' , { } ) ;
1217- await expect ( promise ) . to . be . rejectedWith ( SerenityTransportError ) ;
12181219 } ) ;
12191220 } ) ;
12201221} ) ;
0 commit comments