Skip to content

Commit

Permalink
fix: filter captures test
Browse files Browse the repository at this point in the history
  • Loading branch information
tranquanghuy0801 committed Dec 6, 2021
1 parent b67ce9e commit 0a8caf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/components/GrowerDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ const GrowerDetail = (props) => {
setLoading(true);
let filter = new FilterModel();
filter.planterId = growerId;
capturesContext.getAllCaptures({ filter }).then((response) => {
const captures = await capturesContext.getAllCaptures({ filter });
if (captures && captures.data) {
setVerificationStatus(emptyStatusCount);
let statusCount = emptyStatusCount;
response.data.forEach(capture => {
captures.data.forEach(capture => {
const verificationState = getVerificationStatus(
capture.active,
capture.approved,
Expand All @@ -178,7 +179,7 @@ const GrowerDetail = (props) => {
});
setVerificationStatus(statusCount);
setLoading(false);
})
}
}
}
loadCaptures();
Expand Down
8 changes: 4 additions & 4 deletions src/models/Filter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Filter, with initial values about this filter object', () => {
filter.dateEnd = '2019-07-30';
filter.approved = true;
filter.active = true;
filter.planterId = '1';
filter.planterId = 1;
filter.deviceIdentifier = '1';
filter.planterIdentifier = '1';
});
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('Filter, with initial values about this filter object', () => {

it('getWhereObj() should match: planterId=1', () => {
expect(filter.getWhereObj()).toEqual(
expect.objectContaining({ planterId: '1' }),
expect.objectContaining({ planterId: 1 }),
);
});

Expand Down Expand Up @@ -91,10 +91,10 @@ describe('Filter, with initial values about this filter object', () => {
//}}}
});

describe('set planterId = ""', () => {
describe('set planterId = undefined', () => {
//{{{
beforeEach(() => {
filter.planterId = '';
filter.planterId = undefined;
});

it('loopback object should not match any [planterId]', () => {
Expand Down

0 comments on commit 0a8caf0

Please sign in to comment.