When writing unit tests for Functions on Objects, can I overload the Object constructor?

Hey just double checking can we use whenObjectSet whilst overloading the object set constructor?
I.e.

const MockObj Objects.create().ObjType('mock');

whenObjectSet(Objects.search().ObjType([MockObj])).thenReturn([MockObj])

I want to test my function that:
Takes objSet as input
calls .all() and applies filter
and returns a filtered object set

It currently gives me something like:

TypeError: Converting circular structure to JSON
        --> starting at object with constructor 'ObjTypeImpl'
        |     property 'osp' -> object with constructor ...
        |     property 'createdObjects' -> object with constructor 'Array'
        --- index 0 closes the circle
        at JSON.stringify (<anonymous>)

Got it!

So you just need to do:

const MockObj Objects.create().ObjType('mock');

MockObj.rid = 'mockval'

whenObjectSet(Objects.search().ObjType([MockObj])).thenReturn([MockObj])

I.e. just give the mock object an rid value.