Skip to content

Commit

Permalink
chore: re-naming
Browse files Browse the repository at this point in the history
  • Loading branch information
anjana-bl committed Jan 9, 2025
1 parent d92b014 commit 741bb1f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/migration/2211_ng18/typescript-manual.doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## MyAccountV2OrderHistoryService

Method `getOrderDetailsV2` has been removed. Instead directly use `getOrderDetails`.
Method `getOrderDetails` has been removed. Instead directly use `getOrderDetailsV2`.
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ describe('MyAccountV2OrderHistoryService', () => {
});
});

describe('getOrderDetails', () => {
describe('getOrderDetailsV2', () => {
it('should load order details when not present in the store', fakeAsync(() => {
spyOn(userService, 'takeUserId').and.callThrough();
const sub = service.getOrderDetails(orderCode).subscribe();
const sub = service.getOrderDetailsV2(orderCode).subscribe();

actions$
.pipe(ofType(OrderActions.LOAD_ORDER_BY_ID), take(1))
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('MyAccountV2OrderHistoryService', () => {
spyOn(userService, 'takeUserId').and.callThrough();
store.dispatch(new OrderActions.LoadOrderByIdSuccess(order1));
service
.getOrderDetails(orderCode)
.getOrderDetailsV2(orderCode)
.subscribe((data) => {
expect(data).toEqual(order1);
})
Expand All @@ -232,7 +232,7 @@ describe('MyAccountV2OrderHistoryService', () => {
})
);
service
.getOrderDetails('orderX')
.getOrderDetailsV2('orderX')
.subscribe((data) => {
expect(data).toEqual(undefined);
})
Expand All @@ -242,7 +242,7 @@ describe('MyAccountV2OrderHistoryService', () => {
spyOn(service as any, 'getOrderDetailsState').and.returnValue(
of({ success: null, error: undefined, loading: false, value: null })
);
service.getOrderDetails(orderCode).subscribe(() => {
service.getOrderDetailsV2(orderCode).subscribe(() => {
fail('Should not emit any value');
});
expect((service as any).getOrderDetailsState).toHaveBeenCalledWith(
Expand All @@ -252,7 +252,7 @@ describe('MyAccountV2OrderHistoryService', () => {
});
describe('getOrderDetailsWithTracking', () => {
it('should return order details with consignment tracking', () => {
spyOn(service, 'getOrderDetails').and.returnValue(of(order1));
spyOn(service, 'getOrderDetailsV2').and.returnValue(of(order1));
spyOn(service, 'getConsignmentTracking').and.returnValue(of(tracking1));
service.getOrderDetailsWithTracking(orderCode).subscribe((result) => {
expect(result).toEqual({
Expand All @@ -269,15 +269,15 @@ describe('MyAccountV2OrderHistoryService', () => {
},
],
});
expect(service.getOrderDetails).toHaveBeenCalledWith(orderCode);
expect(service.getOrderDetailsV2).toHaveBeenCalledWith(orderCode);
expect(service.getConsignmentTracking).toHaveBeenCalledWith(
orderCode,
consignmentCode
);
});
});
it('should return order details without consignment tracking', () => {
spyOn(service, 'getOrderDetails').and.returnValue(of(order2));
spyOn(service, 'getOrderDetailsV2').and.returnValue(of(order2));
spyOn(service, 'getConsignmentTracking').and.stub();
service.getOrderDetailsWithTracking(orderCode).subscribe((result) => {
expect(result).toEqual({
Expand All @@ -289,7 +289,7 @@ describe('MyAccountV2OrderHistoryService', () => {
},
],
});
expect(service.getOrderDetails).toHaveBeenCalledWith(orderCode);
expect(service.getOrderDetailsV2).toHaveBeenCalledWith(orderCode);
expect(service.getConsignmentTracking).not.toHaveBeenCalled();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class MyAccountV2OrderHistoryService {
getOrderDetailsWithTracking(
orderCode: string
): Observable<OrderView | undefined> {
return this.getOrderDetails(orderCode).pipe(
return this.getOrderDetailsV2(orderCode).pipe(
switchMap((order: Order | undefined) => {
//-----------------> filling consignment tracking
const orderView: OrderView = { ...order };
Expand Down Expand Up @@ -195,7 +195,7 @@ export class MyAccountV2OrderHistoryService {
});
}

getOrderDetails(code: string): Observable<Order | undefined> {
getOrderDetailsV2(code: string): Observable<Order | undefined> {
const loading$ = this.getOrderDetailsState(code).pipe(
auditTime(0),
tap((state) => {
Expand Down

0 comments on commit 741bb1f

Please sign in to comment.