mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Set up Jest configuration and update dependencies for testing.
- ⚙️ **Config**: Added Jest configuration files for testing - 🗑️ **Chore**: Removed unused Karma configuration and assets - 🛠️ **Refactor**: Updated return details store methods for better clarity - 📚 **Docs**: Enhanced comments and documentation in return details store
This commit is contained in:
5
jest.config.js
Normal file
5
jest.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
const nxPreset = require('@nx/jest/preset').default;
|
||||
|
||||
module.exports = {
|
||||
...nxPreset,
|
||||
};
|
||||
85
junit.xml
Normal file
85
junit.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="jest tests" tests="38" failures="0" errors="0" time="4.387">
|
||||
<testsuite name="ReturnProcessQuestions Validators" errors="0" failures="0" skipped="0" timestamp="2025-04-01T19:08:49" time="2.024" tests="22">
|
||||
<testcase classname="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Eligible when item is ovp and return reason is dislike" name="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Eligible when item is ovp and return reason is dislike" time="0.006">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Eligible when item is ovp, return reason is wrong_item and delivered item is provided" name="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Eligible when item is ovp, return reason is wrong_item and delivered item is provided" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Pending when item is ovp, return reason is wrong_item but delivered item is missing" name="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Pending when item is ovp, return reason is wrong_item but delivered item is missing" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Eligible when item is damaged" name="ReturnProcessQuestions Validators validateBookCalendarQuestions should return Eligible when item is damaged" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateBookCalendarQuestions should return NotEligible for any invalid answers" name="ReturnProcessQuestions Validators validateBookCalendarQuestions should return NotEligible for any invalid answers" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return Eligible when item is ovp" name="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return Eligible when item is ovp" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return Eligible when damaged and item is defective" name="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return Eligible when damaged and item is defective" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return NotEligible when damaged and item is not defective" name="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return NotEligible when damaged and item is not defective" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return NotEligible with invalid answers if keys are missing" name="ReturnProcessQuestions Validators validateTonDatentraegerQuestions should return NotEligible with invalid answers if keys are missing" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateNonbookQuestions should return Eligible when item is ovp and return reason is dislike" name="ReturnProcessQuestions Validators validateNonbookQuestions should return Eligible when item is ovp and return reason is dislike" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateNonbookQuestions should return Eligible when item is ovp, return reason is wrong_item and delivered item is provided" name="ReturnProcessQuestions Validators validateNonbookQuestions should return Eligible when item is ovp, return reason is wrong_item and delivered item is provided" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateNonbookQuestions should return Pending when delivered item is missing for wrong_item reason" name="ReturnProcessQuestions Validators validateNonbookQuestions should return Pending when delivered item is missing for wrong_item reason" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateNonbookQuestions should return Eligible when item is damaged" name="ReturnProcessQuestions Validators validateNonbookQuestions should return Eligible when item is damaged" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateNonbookQuestions should return NotEligible for invalid answers" name="ReturnProcessQuestions Validators validateNonbookQuestions should return NotEligible for invalid answers" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Eligible when item is ovp and return reason is dislike" name="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Eligible when item is ovp and return reason is dislike" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Eligible when item is ovp, return reason is wrong_item and delivered item provided" name="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Eligible when item is ovp, return reason is wrong_item and delivered item provided" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Pending when delivered item is missing for wrong_item reason" name="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Pending when delivered item is missing for wrong_item reason" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Eligible when damaged and item is defective" name="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return Eligible when damaged and item is defective" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return NotEligible when damaged and item is not defective" name="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return NotEligible when damaged and item is not defective" time="0.001">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return NotEligible for invalid answers" name="ReturnProcessQuestions Validators validateAndereElektronischeGeraeteQuestions should return NotEligible for invalid answers" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators CategoryQuestions and Validators mapping should map each category to its questions" name="ReturnProcessQuestions Validators CategoryQuestions and Validators mapping should map each category to its questions" time="0">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessQuestions Validators CategoryQuestions and Validators mapping should map each category to its validator" name="ReturnProcessQuestions Validators CategoryQuestions and Validators mapping should map each category to its validator" time="0">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite name="ReturnDetailsStore" errors="0" failures="0" skipped="0" timestamp="2025-04-01T19:08:49" time="2.62" tests="7">
|
||||
<testcase classname="ReturnDetailsStore Initialization should create an instance of ReturnDetailsStore" name="ReturnDetailsStore Initialization should create an instance of ReturnDetailsStore" time="0.016">
|
||||
</testcase>
|
||||
<testcase classname="ReturnDetailsStore Entity Management beforeFetch should create a new entity and set status to Pending if it does not exist" name="ReturnDetailsStore Entity Management beforeFetch should create a new entity and set status to Pending if it does not exist" time="0.004">
|
||||
</testcase>
|
||||
<testcase classname="ReturnDetailsStore Entity Management beforeFetch should update the existing entity status to Pending" name="ReturnDetailsStore Entity Management beforeFetch should update the existing entity status to Pending" time="0.004">
|
||||
</testcase>
|
||||
<testcase classname="ReturnDetailsStore Entity Management fetchSuccess should update the entity with fetched data and set status to Success" name="ReturnDetailsStore Entity Management fetchSuccess should update the entity with fetched data and set status to Success" time="0.002">
|
||||
</testcase>
|
||||
<testcase classname="ReturnDetailsStore Entity Management fetchError should update the entity status to Error" name="ReturnDetailsStore Entity Management fetchError should update the entity status to Error" time="0.003">
|
||||
</testcase>
|
||||
<testcase classname="ReturnDetailsStore fetch should call the service and update the store on success" name="ReturnDetailsStore fetch should call the service and update the store on success" time="0.004">
|
||||
</testcase>
|
||||
<testcase classname="ReturnDetailsStore fetch should handle errors and update the store accordingly" name="ReturnDetailsStore fetch should handle errors and update the store accordingly" time="0.002">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite name="ReturnProcessStore" errors="0" failures="0" skipped="0" timestamp="2025-04-01T19:08:49" time="2.762" tests="9">
|
||||
<testcase classname="ReturnProcessStore Initialization should create an instance of ReturnProcessStore" name="ReturnProcessStore Initialization should create an instance of ReturnProcessStore" time="0.023">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Initialization should have a nextId computed property" name="ReturnProcessStore Initialization should have a nextId computed property" time="0.006">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Entity Management should remove all entities by process id" name="ReturnProcessStore Entity Management should remove all entities by process id" time="0.004">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Entity Management should set an answer for a given entity" name="ReturnProcessStore Entity Management should set an answer for a given entity" time="0.003">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Entity Management should remove an answer for a given entity" name="ReturnProcessStore Entity Management should remove an answer for a given entity" time="0.002">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Entity Management should set a product category for a given entity" name="ReturnProcessStore Entity Management should set a product category for a given entity" time="0.002">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Process Management should initialize a new return process" name="ReturnProcessStore Process Management should initialize a new return process" time="0.003">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Process Management should throw an error if no returnable items are found" name="ReturnProcessStore Process Management should throw an error if no returnable items are found" time="0.009">
|
||||
</testcase>
|
||||
<testcase classname="ReturnProcessStore Process Management should throw an error if the number of returnable items does not match the total items" name="ReturnProcessStore Process Management should throw an error if the number of returnable items does not match the total items" time="0.004">
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
@@ -1,58 +0,0 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
const testParamIndex = process.argv.findIndex((arg) => arg === 'test');
|
||||
|
||||
let project = process.argv[testParamIndex + 1];
|
||||
|
||||
project = project.replace('@', '').replace('/', '-');
|
||||
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage'),
|
||||
require('karma-junit-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma'),
|
||||
],
|
||||
client: {
|
||||
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true, // removes the duplicated traces
|
||||
},
|
||||
|
||||
reporters: ['progress', 'junit', 'kjhtml'],
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, 'coverage', project),
|
||||
subdir: '.',
|
||||
reporters: [{ type: 'html' }, { type: 'text-summary' }, { type: 'cobertura', file: 'cobertura.xml' }],
|
||||
// include all files
|
||||
includeAllSources: true,
|
||||
},
|
||||
junitReporter: {
|
||||
outputDir: require('path').join(__dirname, 'testresults', project),
|
||||
suite: project,
|
||||
useBrowserName: false,
|
||||
properties: {
|
||||
'project.name': project,
|
||||
},
|
||||
},
|
||||
customLaunchers: {
|
||||
ChromeHeadlessNoSandbox: {
|
||||
base: 'ChromeHeadless',
|
||||
flags: ['--no-sandbox'],
|
||||
},
|
||||
},
|
||||
files: [{ pattern: 'karma/assets/**/*', watched: false, included: false, served: true, nocache: false }],
|
||||
});
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
<svg viewBox="0 0 24 24" version="1.1" >
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 48 B |
@@ -18,4 +18,14 @@ export default {
|
||||
'jest-preset-angular/build/serializers/ng-snapshot',
|
||||
'jest-preset-angular/build/serializers/html-comment',
|
||||
],
|
||||
reporters: [
|
||||
'default',
|
||||
[
|
||||
'jest-junit',
|
||||
{
|
||||
outputDirectory: 'testresults',
|
||||
outputName: `TEST-oms-data-access.xml`,
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
147
libs/oms/data-access/src/lib/return-details.store.spec.ts
Normal file
147
libs/oms/data-access/src/lib/return-details.store.spec.ts
Normal file
@@ -0,0 +1,147 @@
|
||||
import { createServiceFactory } from '@ngneat/spectator/jest';
|
||||
import { ReturnDetailsStore } from './return-details.store';
|
||||
import { ReturnDetailsService } from './return-details.service';
|
||||
import { patchState } from '@ngrx/signals';
|
||||
import { ResultStatus } from '@isa/common/result';
|
||||
import { addEntity } from '@ngrx/signals/entities';
|
||||
import { Receipt } from './models';
|
||||
import { of, throwError } from 'rxjs';
|
||||
|
||||
describe('ReturnDetailsStore', () => {
|
||||
const createService = createServiceFactory({
|
||||
service: ReturnDetailsStore,
|
||||
mocks: [ReturnDetailsService],
|
||||
});
|
||||
|
||||
describe('Initialization', () => {
|
||||
it('should create an instance of ReturnDetailsStore', () => {
|
||||
const spectator = createService();
|
||||
expect(spectator.service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Entity Management', () => {
|
||||
describe('beforeFetch', () => {
|
||||
it('should create a new entity and set status to Pending if it does not exist', () => {
|
||||
const spectator = createService();
|
||||
const receiptId = 123;
|
||||
spectator.service.beforeFetch(receiptId);
|
||||
|
||||
expect(spectator.service.entityMap()[123]).toEqual({
|
||||
id: receiptId,
|
||||
data: undefined,
|
||||
status: ResultStatus.Pending,
|
||||
});
|
||||
});
|
||||
|
||||
it('should update the existing entity status to Pending', () => {
|
||||
const spectator = createService();
|
||||
const receiptId = 123;
|
||||
|
||||
const data = {};
|
||||
|
||||
patchState(
|
||||
spectator.service as any,
|
||||
addEntity({ id: receiptId, data, status: ResultStatus.Idle }),
|
||||
);
|
||||
|
||||
spectator.service.beforeFetch(receiptId);
|
||||
|
||||
expect(spectator.service.entityMap()[123]).toEqual({
|
||||
id: receiptId,
|
||||
data,
|
||||
status: ResultStatus.Pending,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchSuccess', () => {
|
||||
it('should update the entity with fetched data and set status to Success', () => {
|
||||
const spectator = createService();
|
||||
const receiptId = 123;
|
||||
const data: Receipt = { id: receiptId, items: [], buyer: { buyerNumber: '321' } };
|
||||
|
||||
patchState(
|
||||
spectator.service as any,
|
||||
addEntity({ id: receiptId, data: undefined, status: ResultStatus.Pending }),
|
||||
);
|
||||
|
||||
spectator.service.fetchSuccess(receiptId, data);
|
||||
|
||||
expect(spectator.service.entityMap()[123]).toEqual({
|
||||
id: receiptId,
|
||||
data,
|
||||
status: ResultStatus.Success,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchError', () => {
|
||||
it('should update the entity status to Error', () => {
|
||||
const spectator = createService();
|
||||
const receiptId = 123;
|
||||
const error = new Error('Fetch error');
|
||||
|
||||
patchState(
|
||||
spectator.service as any,
|
||||
addEntity({ id: receiptId, data: undefined, status: ResultStatus.Pending }),
|
||||
);
|
||||
|
||||
spectator.service.fetchError(receiptId, error);
|
||||
|
||||
const entity = spectator.service.entityMap()[123];
|
||||
expect(entity).toMatchObject({
|
||||
id: receiptId,
|
||||
status: ResultStatus.Error,
|
||||
error,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetch', () => {
|
||||
it('should call the service and update the store on success', () => {
|
||||
const spectator = createService();
|
||||
const receiptId = 123;
|
||||
const data: Receipt = { id: receiptId, items: [], buyer: { buyerNumber: '321' } };
|
||||
|
||||
spectator.service.beforeFetch(receiptId);
|
||||
spectator.inject(ReturnDetailsService).fetchReturnDetails.mockReturnValueOnce(of(data));
|
||||
|
||||
spectator.service.fetch({ receiptId });
|
||||
|
||||
expect(spectator.inject(ReturnDetailsService).fetchReturnDetails).toHaveBeenCalledWith({
|
||||
receiptId,
|
||||
});
|
||||
|
||||
expect(spectator.service.entityMap()[123]).toEqual({
|
||||
id: receiptId,
|
||||
data,
|
||||
status: ResultStatus.Success,
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle errors and update the store accordingly', () => {
|
||||
const spectator = createService();
|
||||
const receiptId = 123;
|
||||
const error = new Error('Fetch error');
|
||||
|
||||
spectator.service.beforeFetch(receiptId);
|
||||
spectator
|
||||
.inject(ReturnDetailsService)
|
||||
.fetchReturnDetails.mockReturnValueOnce(throwError(() => error));
|
||||
|
||||
spectator.service.fetch({ receiptId });
|
||||
|
||||
expect(spectator.inject(ReturnDetailsService).fetchReturnDetails).toHaveBeenCalledWith({
|
||||
receiptId,
|
||||
});
|
||||
const entity = spectator.service.entityMap()[123];
|
||||
expect(entity).toMatchObject({
|
||||
id: receiptId,
|
||||
status: ResultStatus.Error,
|
||||
error,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,11 @@
|
||||
import { patchState, signalStore, type, withMethods } from '@ngrx/signals';
|
||||
import { addEntity, entityConfig, updateEntity, withEntities } from '@ngrx/signals/entities';
|
||||
import {
|
||||
addEntity,
|
||||
entityConfig,
|
||||
setEntity,
|
||||
updateEntity,
|
||||
withEntities,
|
||||
} from '@ngrx/signals/entities';
|
||||
import { Result, ResultStatus } from '@isa/common/result';
|
||||
import { rxMethod } from '@ngrx/signals/rxjs-interop';
|
||||
import { pipe, switchMap, tap } from 'rxjs';
|
||||
@@ -8,55 +14,86 @@ import { ReturnDetailsService } from './return-details.service';
|
||||
import { tapResponse } from '@ngrx/operators';
|
||||
import { Receipt } from './models';
|
||||
|
||||
/**
|
||||
* Represents the result of a return operation, including the receipt data and status.
|
||||
*/
|
||||
export type ReturnResult = Result<Receipt | undefined> & { id: number };
|
||||
|
||||
/**
|
||||
* Initial state for a return result entity, excluding the unique identifier.
|
||||
*/
|
||||
const initialEntity: Omit<ReturnResult, 'id'> = {
|
||||
data: undefined,
|
||||
status: ResultStatus.Idle,
|
||||
};
|
||||
|
||||
const config = entityConfig({
|
||||
entity: type<ReturnResult>(),
|
||||
selectId: (entity) => entity.id,
|
||||
});
|
||||
|
||||
/**
|
||||
* Store for managing return details using NgRx signals.
|
||||
* Provides methods for fetching and updating return details.
|
||||
*/
|
||||
export const ReturnDetailsStore = signalStore(
|
||||
{ providedIn: 'root' },
|
||||
withEntities(config),
|
||||
withEntities<ReturnResult>(),
|
||||
withMethods((store) => ({
|
||||
_beforeFetch(receiptId: number) {
|
||||
/**
|
||||
* Prepares the store before fetching return details by adding or updating the entity with a pending status.
|
||||
* @param receiptId - The unique identifier of the receipt.
|
||||
* @returns The updated or newly created entity.
|
||||
*/
|
||||
beforeFetch(receiptId: number) {
|
||||
let entity: ReturnResult | undefined = store.entityMap()[receiptId];
|
||||
if (!entity) {
|
||||
entity = { ...initialEntity, id: receiptId, status: ResultStatus.Pending };
|
||||
patchState(store, addEntity(entity));
|
||||
} else {
|
||||
patchState(
|
||||
store,
|
||||
updateEntity({ id: receiptId, changes: { status: ResultStatus.Pending } }),
|
||||
);
|
||||
}
|
||||
patchState(store, addEntity(entity, config));
|
||||
return entity;
|
||||
},
|
||||
_fetchSuccess(receiptId: number, data: Receipt) {
|
||||
|
||||
/**
|
||||
* Updates the store with the fetched return details on a successful fetch operation.
|
||||
* @param receiptId - The unique identifier of the receipt.
|
||||
* @param data - The fetched receipt data.
|
||||
*/
|
||||
fetchSuccess(receiptId: number, data: Receipt) {
|
||||
patchState(
|
||||
store,
|
||||
updateEntity({ id: receiptId, changes: { data, status: ResultStatus.Success } }, config),
|
||||
updateEntity({ id: receiptId, changes: { data, status: ResultStatus.Success } }),
|
||||
);
|
||||
},
|
||||
_fetchError(receiptId: number, error: unknown) {
|
||||
|
||||
/**
|
||||
* Updates the store with an error state if the fetch operation fails.
|
||||
* @param receiptId - The unique identifier of the receipt.
|
||||
* @param error - The error encountered during the fetch operation.
|
||||
*/
|
||||
fetchError(receiptId: number, error: unknown) {
|
||||
patchState(
|
||||
store,
|
||||
updateEntity({ id: receiptId, changes: { error, status: ResultStatus.Error } }, config),
|
||||
updateEntity({ id: receiptId, changes: { error, status: ResultStatus.Error } }),
|
||||
);
|
||||
},
|
||||
})),
|
||||
withMethods((store, returnDetailsService = inject(ReturnDetailsService)) => ({
|
||||
/**
|
||||
* Fetches return details for a given receipt ID.
|
||||
* Updates the store with the appropriate state based on the fetch result.
|
||||
* @param params - An object containing the receipt ID.
|
||||
*/
|
||||
fetch: rxMethod<{ receiptId: number }>(
|
||||
pipe(
|
||||
tap(({ receiptId }) => store._beforeFetch(receiptId)),
|
||||
tap(({ receiptId }) => store.beforeFetch(receiptId)),
|
||||
switchMap(({ receiptId }) =>
|
||||
returnDetailsService.fetchReturnDetails({ receiptId }).pipe(
|
||||
tapResponse({
|
||||
next(value) {
|
||||
store._fetchSuccess(receiptId, value);
|
||||
store.fetchSuccess(receiptId, value);
|
||||
},
|
||||
error(error) {
|
||||
store._fetchError(receiptId, error);
|
||||
store.fetchError(receiptId, error);
|
||||
},
|
||||
}),
|
||||
),
|
||||
|
||||
62
package-lock.json
generated
62
package-lock.json
generated
@@ -22,13 +22,13 @@
|
||||
"@microsoft/signalr": "^8.0.7",
|
||||
"@ng-icons/core": "^29.5.1",
|
||||
"@ng-icons/material-icons": "^29.5.1",
|
||||
"@ngrx/component-store": "19.0.1",
|
||||
"@ngrx/effects": "19.0.1",
|
||||
"@ngrx/entity": "19.0.1",
|
||||
"@ngrx/operators": "19.0.1",
|
||||
"@ngrx/signals": "^19.0.1",
|
||||
"@ngrx/store": "19.0.1",
|
||||
"@ngrx/store-devtools": "19.0.1",
|
||||
"@ngrx/component-store": "19.1.0",
|
||||
"@ngrx/effects": "19.1.0",
|
||||
"@ngrx/entity": "19.1.0",
|
||||
"@ngrx/operators": "19.1.0",
|
||||
"@ngrx/signals": "19.1.0",
|
||||
"@ngrx/store": "19.1.0",
|
||||
"@ngrx/store-devtools": "19.1.0",
|
||||
"angular-oauth2-oidc": "^17.0.2",
|
||||
"angular-oauth2-oidc-jwks": "^17.0.2",
|
||||
"lodash": "^4.17.21",
|
||||
@@ -7077,9 +7077,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ngrx/component-store": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/component-store/-/component-store-19.0.1.tgz",
|
||||
"integrity": "sha512-H/UNz7TMVWF8RUNWwEhfGy6zR5vfMEnGlxcAr+CwxRTryx9H0dsBE6esM/Kj/Po9EOjMFnjiY32ccyOrPUfFWA==",
|
||||
"version": "19.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/component-store/-/component-store-19.1.0.tgz",
|
||||
"integrity": "sha512-CYgmYlSWrNEUiP+5LHA05RhEpqkomFv+C3w0GhpcFcK4dYzipZY7BSJLaYdMCM+Q1Ce3FwBkEMgSSUycL0B5zw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
@@ -7090,37 +7090,37 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ngrx/effects": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-19.0.1.tgz",
|
||||
"integrity": "sha512-q+eztS1zN1247BtUZ41gxhumj4wMmvtfdSMfkFEuu6zuA57Vbx8zitEsw9boqPGtP5E4Cj5HKJLSJrl2kgwgcQ==",
|
||||
"version": "19.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-19.1.0.tgz",
|
||||
"integrity": "sha512-rGRN0ZnzAPmQdUPvmoqZsK7Da/AoCfQcfody+h6PfHTwXNm+M2MRc8tXO6C+fznMRww8ZgNror2dfFmoOSOvNg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "^19.0.0",
|
||||
"@ngrx/store": "19.0.1",
|
||||
"@ngrx/store": "19.1.0",
|
||||
"rxjs": "^6.5.3 || ^7.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@ngrx/entity": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/entity/-/entity-19.0.1.tgz",
|
||||
"integrity": "sha512-Dw6UhLi7tGVWb/pLgYI81k1fPxCIbCWMztGKj08e8fLWoMvTWYTbG5tFbOJNSa9D3gPmxsBbbS8VMNqcUgl7wQ==",
|
||||
"version": "19.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/entity/-/entity-19.1.0.tgz",
|
||||
"integrity": "sha512-Cy+uT5Lzs0fSaqcAtsK6ECac2ETma7UFnSnqLXSKPQmiBMNMMvP2On1c+zxaPgySG2R5kxgA0yDuHGsRiLAprA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "^19.0.0",
|
||||
"@ngrx/store": "19.0.1",
|
||||
"@ngrx/store": "19.1.0",
|
||||
"rxjs": "^6.5.3 || ^7.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@ngrx/operators": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/operators/-/operators-19.0.1.tgz",
|
||||
"integrity": "sha512-4CA+VexfK6nkRb6glmyCSoQgU7zQpEgMF0wVDamxyCO8hJo6E4TwUAN2W5tE5cxWFAsS0+wpFXFncpigvPL9Vw==",
|
||||
"version": "19.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/operators/-/operators-19.1.0.tgz",
|
||||
"integrity": "sha512-gpo69FnoAF69X68pk9eWFHB630xqerBYkF68wOFMciLOV2im3b/fAf+0sRvnQJmVtG/8jO0IPVdvLqa1TbWmPA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
@@ -7130,9 +7130,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ngrx/signals": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/signals/-/signals-19.0.1.tgz",
|
||||
"integrity": "sha512-e9cGgF//tIyN1PKDDcBQkI0csxRcw4r9ezTtDzQpM2gPU5frD9JxaW/YU5gM02ZMl97bUMoI82fBtnDN0RtyWg==",
|
||||
"version": "19.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/signals/-/signals-19.1.0.tgz",
|
||||
"integrity": "sha512-v8sbb+Iox9kdIaKbFgt4Z1W+NxzIU4+g+6qQU6/c27UmtQXv0s1zUKKofPRK0qwkaZzNWkxNToxyoE285ukqcQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
@@ -7148,9 +7148,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ngrx/store": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/store/-/store-19.0.1.tgz",
|
||||
"integrity": "sha512-+6eBLb+0rdJ856JRuKnvSzFxv1ISbYuX/OM12dMPf4wm+ddxjhyvi6tF8lPiNnaYb717PGNxXQzBFIGfIs4zGQ==",
|
||||
"version": "19.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/store/-/store-19.1.0.tgz",
|
||||
"integrity": "sha512-8kKCSFahTpRTx3f/wwcDjItdFnk2IMoorWRjTI2U/MGWuEi4flqLNWcX99s759e7TI6PctiGsaS8jnJXIUS8Jg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
@@ -7161,16 +7161,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ngrx/store-devtools": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/store-devtools/-/store-devtools-19.0.1.tgz",
|
||||
"integrity": "sha512-afvr6NHh12LpYrOH9JKKEEi/z2DHq/wJ45hRn3mrcRDArQTKpTl7V2eu0dYgjGItSRSeJ2drzzKGjccL61PPSg==",
|
||||
"version": "19.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngrx/store-devtools/-/store-devtools-19.1.0.tgz",
|
||||
"integrity": "sha512-c8sV5FQofqm7lF6HTJ4Bb7L/69TaIYHAwEFMbgqbsNoWDx+pilw/It6X9J3LnU8bXjQK4xg6qsgJ7fJIH5X2NA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "^19.0.0",
|
||||
"@ngrx/store": "19.0.1",
|
||||
"@ngrx/store": "19.1.0",
|
||||
"rxjs": "^6.5.3 || ^7.5.0"
|
||||
}
|
||||
},
|
||||
|
||||
16
package.json
16
package.json
@@ -5,7 +5,7 @@
|
||||
"ng": "ng",
|
||||
"start": "nx serve isa-app --ssl",
|
||||
"test": "nx test isa-app",
|
||||
"ci": "nx test isa-app --watch=false --browsers=ChromeHeadless --code-coverage",
|
||||
"ci": "npx nx run-many -t test --exclude isa-app -c ci",
|
||||
"build": "nx build isa-app --configuration=development",
|
||||
"build-prod": "nx build isa-app --configuration=production",
|
||||
"lint": "nx lint",
|
||||
@@ -33,13 +33,13 @@
|
||||
"@microsoft/signalr": "^8.0.7",
|
||||
"@ng-icons/core": "^29.5.1",
|
||||
"@ng-icons/material-icons": "^29.5.1",
|
||||
"@ngrx/component-store": "19.0.1",
|
||||
"@ngrx/effects": "19.0.1",
|
||||
"@ngrx/entity": "19.0.1",
|
||||
"@ngrx/operators": "19.0.1",
|
||||
"@ngrx/signals": "^19.0.1",
|
||||
"@ngrx/store": "19.0.1",
|
||||
"@ngrx/store-devtools": "19.0.1",
|
||||
"@ngrx/component-store": "19.1.0",
|
||||
"@ngrx/effects": "19.1.0",
|
||||
"@ngrx/entity": "19.1.0",
|
||||
"@ngrx/operators": "19.1.0",
|
||||
"@ngrx/signals": "19.1.0",
|
||||
"@ngrx/store": "19.1.0",
|
||||
"@ngrx/store-devtools": "19.1.0",
|
||||
"angular-oauth2-oidc": "^17.0.2",
|
||||
"angular-oauth2-oidc-jwks": "^17.0.2",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
Reference in New Issue
Block a user