Skip to content

Commit

Permalink
fix: add matrix parameter spgid to promotion REST calls (#1310)
Browse files Browse the repository at this point in the history
fix: add matrix parameter spgid to promotion REST calls to avoid 404 response status
  • Loading branch information
SGrueber authored Oct 21, 2022
1 parent a4e6a02 commit 1cae0d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/app/core/services/promotions/promotions.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import { of } from 'rxjs';
import { instance, mock, verify, when } from 'ts-mockito';
import { anything, instance, mock, verify, when } from 'ts-mockito';

import { Promotion } from 'ish-core/models/promotion/promotion.model';
import { ApiService } from 'ish-core/services/api/api.service';
Expand Down Expand Up @@ -39,10 +39,11 @@ describe('Promotions Service', () => {
});

it("should get Promotion data when 'getPromotion' is called", done => {
when(apiServiceMock.get(`promotions/PROMO_UUID`)).thenReturn(of(promotionMockData));
when(apiServiceMock.get(anything(), anything())).thenReturn(of(promotionMockData));

promotionsService.getPromotion('PROMO_UUID').subscribe(data => {
expect(data.id).toEqual('PROMO_UUID');
verify(apiServiceMock.get(`promotions/PROMO_UUID`)).once();
verify(apiServiceMock.get(`promotions/PROMO_UUID`, anything())).once();
done();
});
});
Expand Down
4 changes: 3 additions & 1 deletion src/app/core/services/promotions/promotions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export class PromotionsService {
return throwError(() => new Error('getPromotion() called without a id'));
}

return this.apiService.get<Promotion>(`promotions/${id}`);
return this.apiService.get<Promotion>(`promotions/${id}`, {
sendSPGID: true,
});
}
}

0 comments on commit 1cae0d8

Please sign in to comment.