refactor: find i.p.v. filter
This commit is contained in:
parent
293c51bab3
commit
ac10518cb8
4 changed files with 10 additions and 8 deletions
|
@ -21,7 +21,7 @@ export function expectToBeCorrectEntity<T extends object>(actual: { entity: T; n
|
|||
}
|
||||
for (const property in expected.entity) {
|
||||
if (
|
||||
property! in IGNORE_PROPERTIES &&
|
||||
property in IGNORE_PROPERTIES &&
|
||||
expected.entity[property] !== undefined && // If we don't expect a certain value for a property, we assume it can be filled in by the database however it wants.
|
||||
typeof expected.entity[property] !== 'function' // Functions obviously are not persisted via the database
|
||||
) {
|
||||
|
@ -136,10 +136,10 @@ export function expectToBeCorrectLearningPath(
|
|||
version: node.version,
|
||||
};
|
||||
expect(expectedLearningPathNodes.keys()).toContainEqual(nodeKey);
|
||||
const expectedNode = [...expectedLearningPathNodes.entries()].filter(
|
||||
const expectedNode = [...expectedLearningPathNodes.entries()].find(
|
||||
([key, _]) => key.learningObjectHruid === nodeKey.learningObjectHruid && key.language === node.language && key.version === node.version
|
||||
)[0][1];
|
||||
expect(node.start_node).toEqual(expectedNode?.startNode);
|
||||
)![1];
|
||||
expect(node.start_node).toEqual(expectedNode.startNode);
|
||||
|
||||
expect(new Set(node.transitions.map((it) => it.next.hruid))).toEqual(
|
||||
new Set(expectedNode.transitions.map((it) => it.next.learningObjectHruid))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue