11import environments from "@constants/environments" ;
22import { setAllureEpic } from "@helpers/allure" ;
33import { skipIfNotHardFork } from "@helpers/cardano" ;
4- import { fetchFirstActiveDRepDetails } from "@helpers/dRep" ;
4+ import { convertDRep , fetchFirstActiveDRepDetails } from "@helpers/dRep" ;
55import { functionWaitedAssert } from "@helpers/waitedLoop" ;
66import DRepDetailsPage from "@pages/dRepDetailsPage" ;
77import DRepDirectoryPage from "@pages/dRepDirectoryPage" ;
@@ -27,6 +27,8 @@ const statusRank: Record<DRepStatus, number> = {
2727 Retired : 3 ,
2828} ;
2929
30+ const scripDRepId = require ( "../../lib/_mock/scriptDRep.json" ) ;
31+
3032test ( "2K_2. Should sort DReps" , async ( { page } ) => {
3133 test . slow ( ) ;
3234
@@ -223,3 +225,30 @@ test.describe("DRep dependent tests", () => {
223225 expect ( copiedTextDRepDirectory ) . toEqual ( dRepId ) ;
224226 } ) ;
225227} ) ;
228+
229+ test ( "2Y. Should correctly convert CIP-129/CIP-105 script dRep" , async ( { page } ) => {
230+ const dRepId = scripDRepId . elements [ 0 ] [ "drepId" ] ;
231+ await page . route ( "**/drep/list?page=0&pageSize=10&**" , async ( route ) => {
232+ await route . fulfill ( {
233+ status : 200 ,
234+ contentType : "application/json" ,
235+ body : JSON . stringify ( scripDRepId ) ,
236+ } ) ;
237+ } ) ;
238+
239+ const responsePromise = page . waitForResponse (
240+ "**/drep/list?page=0&pageSize=10&**"
241+ ) ;
242+
243+ const { cip129, cip105 } = convertDRep ( dRepId , true ) ;
244+
245+ await page . goto ( `/drep_directory/${ dRepId } ` ) ;
246+ await responsePromise ;
247+
248+ await expect (
249+ page . getByTestId ( "cip-129-drep-id-info-item-description" )
250+ ) . toHaveText ( cip129 , { timeout : 60_000 } ) ;
251+ await expect (
252+ page . getByTestId ( "cip-105-drep-id-info-item-description" )
253+ ) . toHaveText ( cip105 ) ;
254+ } ) ;
0 commit comments