Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit 69ca3a8

Browse files
author
Christoph Bühler
committed
fix(route-id): Fixing generation of route ids
1 parent 78fed28 commit 69ca3a8

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/core/routes/GiuseppeBaseRoute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class GiuseppeBaseRoute implements RouteDefinition {
7474
): GiuseppeRoute[] {
7575
return [
7676
{
77-
id: `${HttpMethod[this.httpMethod]}_${baseUrl}_${this.route}`,
77+
id: `${HttpMethod[this.httpMethod]}_${UrlHelper.buildUrl(baseUrl, this.route)}`,
7878
name: this.name,
7979
method: this.httpMethod,
8080
url: UrlHelper.buildUrl(baseUrl, this.route),

test/__snapshots__/Giuseppe.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ Array [
5353
]
5454
`;
5555

56-
exports[`Giuseppe Core configureRouter() should throw on a duplicate route 1`] = `"A route with the ID 'get_baseUrl_getFunc' (method name: 'func2', url: 'baseUrl/getFunc') is already registered."`;
56+
exports[`Giuseppe Core configureRouter() should throw on a duplicate route 1`] = `"A route with the ID 'get_baseUrl/getFunc' (method name: 'func2', url: 'baseUrl/getFunc') is already registered."`;

test/core/controller/CoreController.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('Core controller', () => {
106106

107107
const ctrl = Giuseppe.registrar.controller[0];
108108
const route = ctrl.createRoutes('')[0];
109-
expect(route.id).toBe('get__');
109+
expect(route.id).toBe('get_');
110110
expect(route.name).toBe('get');
111111
});
112112

@@ -127,15 +127,15 @@ describe('Core controller', () => {
127127
const routes = ctrl.createRoutes('');
128128

129129
let route = routes[0];
130-
expect(route.id).toBe('get_api_foobar');
130+
expect(route.id).toBe('get_api/foobar');
131131
expect(route.url).toBe('api/foobar');
132132

133133
route = routes[1];
134-
expect(route.id).toBe('get_api_/barfoo');
134+
expect(route.id).toBe('get_api/barfoo');
135135
expect(route.url).toBe('api/barfoo');
136136

137137
route = routes[2];
138-
expect(route.id).toBe('get_api_/rootfoo');
138+
expect(route.id).toBe('get_api/rootfoo');
139139
expect(route.url).toBe('api/rootfoo');
140140
});
141141

test/core/routes/CoreRoutes.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ describe('Core routes', () => {
211211
const route = meta.routes()[0];
212212
const generated = route.createRoutes(meta, '', [])[0];
213213

214-
expect(generated.id).toBe(`${run.name}__TheUrl`);
214+
expect(generated.id).toBe(`${run.name}_TheUrl`);
215215
});
216216

217217
it('should use the correct name', () => {

0 commit comments

Comments
 (0)