Hi I have a function which uses ObjectSet as an input. I’m creating unit tests but it doesn’t work. Below is my function and the unit test code.
@Function()
public async testFunction (testObjectSet: ObjectSet<fakeObject>): Promise<ObjectSet<fakeObject>> {
const result = await testObjectSet
.groupBy(obj => obj.title.exactValues({maxBuckets: 10}))
.max(obj => obj.submittedAt);
const newResult = fakeObject.filter(note =>
note.submittedAt.exactMatch(result.buckets.find(group => note.title.exactMatch(group.key))?.value!)
);
return newResult;
}
whenObjectSet(Objects.search().fakeObject().all()).thenReturn(stubSet);
var temp = Objects.search().fakeObject()
var result = await (await myFunctions.testFunction(temp))