core-plugin-api: add forwards compatibility for route refs
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -25,10 +25,12 @@ describe('ExternalRouteRef', () => {
|
||||
expect(internal.getParams()).toEqual([]);
|
||||
|
||||
expect(String(internal)).toMatch(
|
||||
/^ExternalRouteRef\{created at '.*ExternalRouteRef\.test\.ts.*'\}$/,
|
||||
/^externalRouteRef\{id=undefined,at='.*ExternalRouteRef\.test\.ts.*'\}$/,
|
||||
);
|
||||
internal.setId('some-id');
|
||||
expect(String(internal)).toBe('ExternalRouteRef{some-id}');
|
||||
expect(String(internal)).toMatch(
|
||||
/^externalRouteRef\{id=some-id,at='.*ExternalRouteRef\.test\.ts.*'\}$/,
|
||||
);
|
||||
});
|
||||
|
||||
it('should be created with params', () => {
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('RouteRef', () => {
|
||||
expect(internal.getDescription()).toMatch(/RouteRef\.test\.ts/);
|
||||
|
||||
expect(String(internal)).toMatch(
|
||||
/^RouteRef\{created at .*RouteRef\.test\.ts.*\}$/,
|
||||
/^routeRef\{id=undefined,at='.*RouteRef\.test\.ts.*'\}$/,
|
||||
);
|
||||
|
||||
expect(() => internal.setId('')).toThrow(
|
||||
@@ -35,7 +35,9 @@ describe('RouteRef', () => {
|
||||
);
|
||||
|
||||
internal.setId('some-id');
|
||||
expect(String(internal)).toBe('RouteRef{some-id}');
|
||||
expect(String(internal)).toMatch(
|
||||
/^routeRef\{id=some-id,at='.*RouteRef\.test\.ts.*'\}$/,
|
||||
);
|
||||
internal.setId('some-id'); // Should allow same ID
|
||||
|
||||
expect(() => internal.setId('some-other-id')).toThrow(
|
||||
|
||||
@@ -35,10 +35,12 @@ describe('SubRouteRef', () => {
|
||||
expect(internal.getParent()).toBe(internalParent);
|
||||
expect(internal.getParams()).toEqual([]);
|
||||
expect(String(internal)).toMatch(
|
||||
/SubRouteRef\{at \/foo with parent created at '.*SubRouteRef\.test\.ts.*'\}/,
|
||||
/^subRouteRef\{path='\/foo',parent=routeRef\{id=undefined,at='.*SubRouteRef\.test\.ts.*'\}\}$/,
|
||||
);
|
||||
internalParent.setId('some-id');
|
||||
expect(String(internal)).toBe('SubRouteRef{at /foo with parent some-id}');
|
||||
expect(String(internal)).toMatch(
|
||||
/^subRouteRef\{path='\/foo',parent=routeRef\{id=some-id,at='.*SubRouteRef\.test\.ts.*'\}\}$/,
|
||||
);
|
||||
});
|
||||
|
||||
it('should be created with params', () => {
|
||||
|
||||
Reference in New Issue
Block a user