@@ -15,13 +15,17 @@ import {
1515 creditHistoryRegistry ,
1616} from "./mocks/handlers" ;
1717
18- import registry from "../public/registry.json" ;
18+ import { readFileSync } from "fs" ;
19+ import { feast } from "./protos" ;
20+ import path from "path" ;
1921
2022// declare which API requests to mock
2123const server = setupServer (
2224 projectsListWithDefaultProject ,
2325 creditHistoryRegistry
2426) ;
27+ const registry = readFileSync ( path . resolve ( __dirname , "../public/registry.db" ) ) ;
28+ const parsedRegistry = feast . core . Registry . decode ( registry ) ;
2529
2630// establish API mocking before all tests
2731beforeAll ( ( ) => server . listen ( ) ) ;
@@ -50,7 +54,10 @@ test("full app rendering", async () => {
5054 // Explore Panel Should Appear
5155 expect ( screen . getByText ( / E x p l o r e t h i s P r o j e c t / i) ) . toBeInTheDocument ( ) ;
5256
53- const projectNameRegExp = new RegExp ( registry . project , "i" ) ;
57+ const projectNameRegExp = new RegExp (
58+ parsedRegistry . projectMetadata [ 0 ] . project ! ,
59+ "i"
60+ ) ;
5461
5562 // It should load the default project, which is credit_scoring_aws
5663 await waitFor ( ( ) => {
@@ -95,9 +102,9 @@ test("routes are reachable", async () => {
95102 }
96103} ) ;
97104
98-
99- const featureViewName = registry . featureViews [ 0 ] . spec . name ;
100- const featureName = registry . featureViews [ 0 ] . spec . features [ 0 ] . name ;
105+ const spec = parsedRegistry . featureViews [ 0 ] . spec ! ;
106+ const featureViewName = spec . name ! ;
107+ const featureName = spec . features ! [ 0 ] ! . name ! ;
101108
102109test ( "features are reachable" , async ( ) => {
103110 render ( < FeastUISansProviders /> ) ;
@@ -106,10 +113,7 @@ test("features are reachable", async () => {
106113 await screen . findByText ( / E x p l o r e t h i s P r o j e c t / i) ;
107114 const routeRegExp = new RegExp ( "Feature Views" , "i" ) ;
108115
109- userEvent . click (
110- screen . getByRole ( "button" , { name : routeRegExp } ) ,
111- leftClick
112- ) ;
116+ userEvent . click ( screen . getByRole ( "button" , { name : routeRegExp } ) , leftClick ) ;
113117
114118 screen . getByRole ( "heading" , {
115119 name : "Feature Views" ,
@@ -118,18 +122,12 @@ test("features are reachable", async () => {
118122 await screen . findAllByText ( / F e a t u r e V i e w s / i) ;
119123 const fvRegExp = new RegExp ( featureViewName , "i" ) ;
120124
121- userEvent . click (
122- screen . getByRole ( "link" , { name : fvRegExp } ) ,
123- leftClick
124- )
125+ userEvent . click ( screen . getByRole ( "link" , { name : fvRegExp } ) , leftClick ) ;
125126
126127 await screen . findByText ( featureName ) ;
127128 const fRegExp = new RegExp ( featureName , "i" ) ;
128129
129- userEvent . click (
130- screen . getByRole ( "link" , { name : fRegExp } ) ,
131- leftClick
132- )
130+ userEvent . click ( screen . getByRole ( "link" , { name : fRegExp } ) , leftClick ) ;
133131 // Should land on a page with the heading
134132 // await screen.findByText("Feature: " + featureName);
135133 screen . getByRole ( "heading" , {
0 commit comments