Apply suggestions from code review

Co-authored-by: Marley <55280588+marleypowell@users.noreply.github.com>
Signed-off-by: Jacob Wejendorp <jwe@tradeshift.com>
This commit is contained in:
Jacob Wejendorp
2021-12-16 17:26:53 +01:00
parent 6ff4408fa6
commit 91c353da3a
2 changed files with 8 additions and 10 deletions
@@ -142,16 +142,14 @@ const latestSchemasMock = jest.fn().mockImplementation(() => [
},
]);
const factsBetweenTimestampsByIdsMock = jest.fn();
const latestFactsByIdsMock = jest.fn().mockImplementation(() =>
Promise.resolve({
['test-factretriever']: {
id: 'test-factretriever',
facts: {
testnumberfact: 3,
},
const latestFactsByIdsMock = jest.fn().mockResolvedValue({
['test-factretriever']: {
id: 'test-factretriever',
facts: {
testnumberfact: 3,
},
}),
);
},
});
const mockCheckRegistry = {
getAll(checks: string[]) {
return checks.flatMap(check => testChecks[check]);
@@ -90,7 +90,7 @@ export class JsonRulesEngineFactChecker
rule.name = techInsightCheck.id;
// Only run checks that have all the facts available:
const hasAllFacts = techInsightCheck.factIds.every(
retrieverId => !!facts[retrieverId],
factId => !!facts[factId],
);
if (hasAllFacts) {
engine.addRule({ ...techInsightCheck.rule, event: noopEvent });