Skip to content

Commit bac14e4

Browse files
author
tomas_backbase
committed
chore: adjust documentation to be checked against implementation code
1 parent 52e4702 commit bac14e4

File tree

6 files changed

+46
-117
lines changed

6 files changed

+46
-117
lines changed

libs/ach-positive-pay-journey/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@backbase/ach-positive-pay-journey",
33
"version": "0.0.1",
44
"peerDependencies": {
5-
"@angular/core": "^20.3.12",
65
"@backbase/foundation-ang": "^13.0.4",
76
"@angular/router": "^20.3.12"
87
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './lib/provide-ach-positive-pay-journey';
1+
export { achPositivePayJourney } from './lib/provide-ach-positive-pay-journey';
22
export * from './lib/ach-positive-pay-journey.routes';

libs/ach-positive-pay-journey/src/lib/ach-positive-pay-journey.routes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AchPositivePayRulesComponent } from '@backbase/ach-positive-pay-journey
77
import { EntitlementsGuard } from '@backbase/foundation-ang/entitlements';
88
import { PERMISSIONS } from '@backbase/ach-positive-pay-journey/internal/shared-data';
99

10-
export const achPositivePayDefaultRoutes: Routes = [
10+
const achPositivePayDefaultRoutes: Routes = [
1111
{
1212
path: 'rules',
1313
component: AchPositivePayJourneyComponent,
@@ -31,3 +31,5 @@ export const achPositivePayDefaultRoutes: Routes = [
3131
},
3232
{ path: '', pathMatch: 'full', redirectTo: 'rules' },
3333
];
34+
35+
export default achPositivePayDefaultRoutes;
Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1-
import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';
2-
import { provideRoutes, Routes } from '@angular/router';
3-
import { achPositivePayDefaultRoutes } from './ach-positive-pay-journey.routes';
1+
import { journeyFactory } from '@backbase/foundation-ang/core';
2+
import defaultRoutes from './ach-positive-pay-journey.routes';
43

54
/**
6-
* Provides the ACH Positive Pay Journey configuration in a standalone context.
5+
* Creates and configures the ACH Positive Pay Journey using the journey factory pattern.
76
*
8-
* @param routes - Optional custom routes. If not provided, uses default routes.
9-
* @returns Environment providers for ACH Positive Pay Journey
7+
* The journey factory provides a flexible, type-safe way to configure and extend the journey.
8+
* It allows consumers to:
9+
* - Override default routes
10+
* - Add custom providers
11+
* - Customize behavior through configuration tokens
1012
*
1113
* @example
1214
* ```typescript
13-
* import { ApplicationConfig } from '@angular/core';
14-
* import { provideAchPositivePayJourney } from '@backbase/ach-positive-pay-journey';
15+
* // In app/journeys/ach-positive-pay.ts
16+
* import { achPositivePayJourney } from '@backbase/ach-positive-pay-journey';
17+
* import type { Routes } from '@angular/router';
1518
*
16-
* export const appConfig: ApplicationConfig = {
17-
* providers: [
18-
* provideAchPositivePayJourney(),
19-
* ],
20-
* };
19+
* export default achPositivePayJourney();
20+
*
21+
* // Then in app routing:
22+
* const routes: Routes = [
23+
* {
24+
* path: 'ach-positive-pay',
25+
* loadChildren: () => import('./journeys/ach-positive-pay'),
26+
* },
27+
* ];
2128
* ```
2229
*/
23-
export function provideAchPositivePayJourney(
24-
routes: Routes = achPositivePayDefaultRoutes
25-
): EnvironmentProviders {
26-
return makeEnvironmentProviders([provideRoutes(routes)]);
27-
}
30+
export const { achPositivePayJourney } = journeyFactory({
31+
journeyName: 'achPositivePayJourney',
32+
defaultRoutes,
33+
tokens: {},
34+
});
Lines changed: 4 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,8 @@
1-
import { Routes } from '@angular/router';
2-
import achPositivePayBundle, {
3-
ACH_POSITIVE_PAY_ROUTES,
4-
} from './ach-positive-pay-journey-bundle';
1+
import achPositivePayBundle from './ach-positive-pay-journey-bundle';
52

63
describe('AchPositivePayJourneyBundle', () => {
7-
describe('Default Export', () => {
8-
it('should export routes as default export', () => {
9-
expect(achPositivePayBundle).toBeDefined();
10-
expect(Array.isArray(achPositivePayBundle)).toBe(true);
11-
});
12-
13-
it('should have routes with valid structure', () => {
14-
expect(achPositivePayBundle.length).toBeGreaterThan(0);
15-
expect(achPositivePayBundle[0]).toHaveProperty('path');
16-
});
17-
18-
it('should define the rules path as first route', () => {
19-
const rulesRoute = achPositivePayBundle.find(
20-
(route) => route.path === 'rules'
21-
);
22-
expect(rulesRoute).toBeDefined();
23-
});
24-
25-
it('should have component or children defined for rules route', () => {
26-
const rulesRoute = achPositivePayBundle.find(
27-
(route) => route.path === 'rules'
28-
);
29-
expect(rulesRoute).toBeDefined();
30-
const hasComponent = rulesRoute?.component !== undefined;
31-
const hasChildren = rulesRoute?.children !== undefined;
32-
expect(hasComponent || hasChildren).toBe(true);
33-
});
34-
35-
it('should include redirect to rules for empty path', () => {
36-
const redirectRoute = achPositivePayBundle.find(
37-
(route) => route.path === '' && route.redirectTo === 'rules'
38-
);
39-
expect(redirectRoute).toBeDefined();
40-
});
41-
});
42-
43-
describe('Named Export (Backward Compatibility)', () => {
44-
it('should export ACH_POSITIVE_PAY_ROUTES as named export', () => {
45-
expect(ACH_POSITIVE_PAY_ROUTES).toBeDefined();
46-
expect(Array.isArray(ACH_POSITIVE_PAY_ROUTES)).toBe(true);
47-
});
48-
49-
it('should have consistent route configuration between default and named exports', () => {
50-
expect(achPositivePayBundle).toEqual(ACH_POSITIVE_PAY_ROUTES);
51-
});
52-
53-
it('should maintain Routes type compatibility', () => {
54-
const routes: Routes = ACH_POSITIVE_PAY_ROUTES;
55-
expect(routes).toBeDefined();
56-
expect(Array.isArray(routes)).toBe(true);
57-
});
58-
});
59-
60-
describe('Route Structure', () => {
61-
it('should have children routes under rules path', () => {
62-
const rulesRoute = achPositivePayBundle.find(
63-
(route) => route.path === 'rules'
64-
);
65-
expect(rulesRoute?.children).toBeDefined();
66-
expect(rulesRoute?.children?.length).toBeGreaterThan(0);
67-
});
68-
69-
it('should include list route as child of rules', () => {
70-
const rulesRoute = achPositivePayBundle.find(
71-
(route) => route.path === 'rules'
72-
);
73-
const listRoute = rulesRoute?.children?.find(
74-
(route) => route.path === 'list'
75-
);
76-
expect(listRoute).toBeDefined();
77-
});
78-
79-
it('should include new rule route with modal outlet', () => {
80-
const rulesRoute = achPositivePayBundle.find(
81-
(route) => route.path === 'rules'
82-
);
83-
const newRoute = rulesRoute?.children?.find(
84-
(route) => route.path === 'new'
85-
);
86-
expect(newRoute).toBeDefined();
87-
expect(newRoute?.outlet).toBe('modal');
88-
});
4+
it('should provide routes for lazy loading', () => {
5+
expect(achPositivePayBundle).toBeDefined();
6+
expect(achPositivePayBundle.length).toBeGreaterThan(0);
897
});
908
});
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import { Routes } from '@angular/router';
2-
import { achPositivePayDefaultRoutes } from '@backbase/ach-positive-pay-journey';
1+
import { achPositivePayJourney } from '@backbase/ach-positive-pay-journey';
32

43
/**
54
* ACH Positive Pay Journey Bundle
65
*
7-
* This file provides the journey routes for lazy loading.
6+
* This file provides the journey routes for lazy loading using the journey factory pattern.
87
* Use `loadChildren: () => import('./ach-positive-pay-journey-bundle')` in your route configuration.
98
*
109
* The routes include all necessary components and guards from the journey library.
10+
*
11+
* @example
12+
* ```typescript
13+
* const routes: Routes = [
14+
* {
15+
* path: 'ach-positive-pay',
16+
* loadChildren: () => import('@backbase/journey-bundles/ach-positive-pay'),
17+
* },
18+
* ];
19+
* ```
1120
*/
12-
const routes: Routes = achPositivePayDefaultRoutes;
13-
14-
// Default export for Angular lazy loading
15-
export default routes;
16-
17-
// Named export for backward compatibility and testing
18-
export const ACH_POSITIVE_PAY_ROUTES = routes;
21+
export default achPositivePayJourney();

0 commit comments

Comments
 (0)