-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3.2.2: removing empty users and limiting slack messages
- Loading branch information
1 parent
312efe2
commit b1825f0
Showing
13 changed files
with
174 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const { entries } = require('../../../../tests/mocks'); | ||
const removeEmpty = require('../removeEmpty'); | ||
|
||
describe('Interactors | .buildTable | .removeEmpty', () => { | ||
const mainStats = ['timeToReview', 'totalReviews', 'totalComments']; | ||
|
||
it('keeps all the entry when no stats are empty', () => { | ||
const response = removeEmpty(entries, mainStats); | ||
expect(response).toHaveLength(entries.length); | ||
expect(response).toMatchObject(entries); | ||
}); | ||
|
||
it('removes the entries if they have no requested stats', () => { | ||
const input = entries.map((entry) => ({ | ||
...entry, | ||
stats: { | ||
...entry.stats, | ||
timeToReview: null, | ||
totalReviews: null, | ||
totalComments: null, | ||
}, | ||
})); | ||
const response = removeEmpty(input, mainStats); | ||
expect(response).toEqual([]); | ||
}); | ||
|
||
it('keeps the entries if they have some requested stats', () => { | ||
const input = entries.map((entry) => ({ | ||
...entry, | ||
stats: { | ||
...entry.stats, | ||
totalComments: 0, | ||
}, | ||
})); | ||
const response = removeEmpty(input, mainStats); | ||
expect(response).toHaveLength(entries.length); | ||
expect(response).toMatchObject(input); | ||
}); | ||
|
||
it('removes all if no stats are requested', () => { | ||
const response = removeEmpty(entries, []); | ||
expect(response).toEqual([]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const removeEmpty = (entries, mainStats) => entries | ||
.filter((entry) => mainStats.some((stat) => !!entry.stats[stat])); | ||
|
||
module.exports = removeEmpty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.