forked from rx-angular/rx-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle query string for filesystem cache rx-angular#1690
- Loading branch information
Showing
2 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
libs/isr/server/src/cache-handlers/filesystem-cache-handler.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
convertFileNameToRoute, | ||
convertRouteToFileName, | ||
} from './filesystem-cache-handler'; | ||
|
||
// Use the functions as needed | ||
describe('Route and File Name Conversion', () => { | ||
describe('convertRouteToFileName', () => { | ||
it('should convert a simple route without query parameters', () => { | ||
const route = '/users/profile'; | ||
const expectedFileName = '__users__profile'; | ||
expect(convertRouteToFileName(route)).toEqual(expectedFileName); | ||
}); | ||
|
||
it('should convert a route with query parameters', () => { | ||
const route = '/search?query=test'; | ||
const expectedFileName = '__search++query=test'; | ||
expect(convertRouteToFileName(route)).toEqual(expectedFileName); | ||
}); | ||
}); | ||
|
||
describe('convertFileNameToRoute', () => { | ||
it('should convert a simple file name back to a route', () => { | ||
const fileName = '__users__profile'; | ||
const expectedRoute = '/users/profile'; | ||
expect(convertFileNameToRoute(fileName)).toEqual(expectedRoute); | ||
}); | ||
|
||
it('should convert a file name with "++" back to a route with a query parameter', () => { | ||
const fileName = '__search++query=test'; | ||
const expectedRoute = '/search?query=test'; | ||
expect(convertFileNameToRoute(fileName)).toEqual(expectedRoute); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters