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:
+7
-9
@@ -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]);
|
||||
|
||||
+1
-1
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user