How to implement a unit test for a function using links to retrieve objects?

Given a function that has some implementation below:

function(anObject) {
...
const myLinkedObj = anObject.linkedObject.get()
... process data using anObject and myLinkedObj
return processedData

When trying to implement a unit test for this, the anObject.linkedObject.get() call returns undefined and fails the unit test. As unit tests have no network calls, what is the best way to mock the call using a stubbed object?

you can create a factory that calls the Objects.create() api to create you mock objects and set the linked object type via the .set() method of the SingleLinkType which also has the .get method.
There are some caveats regarding this which i recently mentioned in a different thread.
https://community.palantir.com/t/unexpected-test-results-in-typescript-unit-tests-when-using-objects-api/3522?u=flackermann