Thanks to visit codestin.com
Credit goes to github.com

Skip to content

JSON.stringify() does not play well #138

@AuHau

Description

@AuHau

Describe the bug
When calling JSON.stringify on Substitute I will receive undefined. While I understand that it is hard to decide what should be returned I would expect at least something and not undefined.

I think that the toJSON() function could be employed here to define some behavior.

To Reproduce

interface Obj {
	hello: string
}
const sub = Substitute.for<Obj>()
sub.hello.returns('world')
JSON.stringify(sub) // undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions