Skip to content

Commit cdbeab8

Browse files
committed
Merge branch 'fix/broken-unit-test-5904' into 'master'
Fix broken unit tests #5904 See merge request minds/front!2181
2 parents e7b8776 + 852118a commit cdbeab8

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

src/app/modules/boost/console-v2/services/console.service.spec.ts

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ describe('BoostConsoleService', () => {
7373
(service as any).api.post.calls.reset();
7474

7575
(service as any).session.isAdmin.and.returnValue(false);
76+
77+
(service as any).adminStats.decrementPendingSafeCount.calls.reset();
78+
(service as any).adminStats.decrementPendingControversialCount.calls.reset();
79+
7680
service.suitabilityFilterValue$.next('safe');
7781
});
7882

@@ -112,23 +116,33 @@ describe('BoostConsoleService', () => {
112116
service.suitabilityFilterValue$.next('safe');
113117
(service as any).session.isAdmin.and.returnValue(true);
114118
(service as any).api.post.and.returnValue(of({}));
119+
let boost = mockBoost;
120+
boost.rejection_reason = 1;
121+
122+
await service.reject(mockBoost).toPromise();
123+
124+
expect((service as any).api.post).toHaveBeenCalledWith(
125+
'api/v3/boosts/123/reject',
126+
{
127+
reason: boost.rejection_reason,
128+
}
129+
);
130+
});
131+
132+
it('should reject and decrement admin stat count for controversial boosts', async () => {
133+
service.suitabilityFilterValue$.next('controversial');
134+
(service as any).session.isAdmin.and.returnValue(true);
135+
(service as any).api.post.and.returnValue(of({}));
136+
let boost = mockBoost;
137+
boost.rejection_reason = 1;
115138

116139
await service.reject(mockBoost);
117140

118-
expect(
119-
(service as any).adminStats.decrementPendingSafeCount
120-
).toHaveBeenCalled();
141+
expect((service as any).api.post).toHaveBeenCalledWith(
142+
'api/v3/boosts/123/reject',
143+
{
144+
reason: boost.rejection_reason,
145+
}
146+
);
121147
});
122-
//
123-
// it('should reject and decrement admin stat count for controversial boosts', async () => {
124-
// service.suitabilityFilterValue$.next('controversial');
125-
// (service as any).session.isAdmin.and.returnValue(true);
126-
// (service as any).api.post.and.returnValue(of({}));
127-
//
128-
// await service.reject(mockBoost);
129-
//
130-
// expect(
131-
// (service as any).adminStats.decrementPendingControversialCount
132-
// ).toHaveBeenCalled();
133-
// });
134148
});

0 commit comments

Comments
 (0)