@@ -913,13 +913,26 @@ describe("flatRoutes", () => {
913
913
} ) ;
914
914
} ) ;
915
915
916
- test ( "should include a valid file for a route outside of the app directory" , ( ) => {
917
- const routesDir = path . join ( "test" , "root" , "routes" ) ;
918
- const routeFile = path . join ( routesDir , "route.tsx" ) ;
919
-
920
- const manifest = flatRoutesUniversal ( APP_DIR , [ routeFile ] ) ;
921
- const routeInfo = manifest [ path . relative ( APP_DIR , routesDir ) ] ;
922
- expect ( routeInfo ) . toBeDefined ( ) ;
923
- expect ( routeInfo . file ) . toBe ( path . relative ( APP_DIR , routeFile ) ) ;
916
+ describe ( "generates route manifest entry files relative to the app directory" , ( ) => {
917
+ let testCases : [ string , string ] [ ] = [
918
+ [ path . posix . join ( APP_DIR , "routes" ) , "routes" ] ,
919
+ [
920
+ path . posix . join ( APP_DIR , ".." , "routes" ) ,
921
+ path . posix . join ( ".." , "routes" ) ,
922
+ ] ,
923
+ ] ;
924
+
925
+ let fileName = "route.tsx" ;
926
+
927
+ testCases . forEach ( ( [ routesDir , expected ] ) => {
928
+ test ( `for routes directory "${ routesDir } "` , ( ) => {
929
+ const routeFile = path . join ( routesDir , fileName ) ;
930
+ const routeInfo = flatRoutesUniversal ( APP_DIR , [ routeFile ] ) ;
931
+ const routes = Object . values ( routeInfo ) ;
932
+
933
+ expect ( routes ) . toHaveLength ( 1 ) ;
934
+ expect ( routes [ 0 ] . file ) . toBe ( path . posix . join ( expected , fileName ) ) ;
935
+ } ) ;
936
+ } ) ;
924
937
} ) ;
925
938
} ) ;
0 commit comments