@@ -913,13 +913,27 @@ 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
+ const testCases : [ string , string ] [ ] = [
918
+ [
919
+ path . posix . join ( APP_DIR , "routes" , "route.tsx" ) ,
920
+ path . posix . join ( "routes" , "route.tsx" ) ,
921
+ ] ,
922
+ [
923
+ path . posix . join ( APP_DIR , ".." , "routes" , "route.tsx" ) ,
924
+ path . posix . join ( ".." , "routes" , "route.tsx" ) ,
925
+ ] ,
926
+ ] ;
927
+
928
+ testCases . forEach ( ( [ routesDir , expected ] ) => {
929
+ test ( `for routes directory "${ routesDir } "` , ( ) => {
930
+ const routeFile = path . join ( routesDir , "route.tsx" ) ;
931
+ const routeInfo = flatRoutesUniversal ( APP_DIR , [ routeFile ] ) ;
932
+ const routes = Object . values ( routeInfo ) ;
933
+
934
+ expect ( routes ) . toHaveLength ( 1 ) ;
935
+ expect ( routes [ 0 ] . file ) . toBe ( path . posix . join ( expected , "route.tsx" ) ) ;
936
+ } ) ;
937
+ } ) ;
924
938
} ) ;
925
939
} ) ;
0 commit comments