Writing a test to check if object returns null or string

Hey all!

I trying to check that an object returns either null or a dynamic string value but im struggling to find the right way to write the tests.
Below is part of the response thats being returned that i want to check.

 "image": null,
                    "label_image": null,
                    "model_image": "https://m.media-amazon.com/images/I/41hZWA3Ax4L._SL500_.jpg",
                    "shipping": {
                        "prime": false,
                        "url": null

Now, the objects will return either a string value or null so i need a test that checks that, below is what i have so far:

pm.expect(responseJson.widget.data.offers[0].model_image === 'string' || responseJson.widget.data.offers[0].model_image === null).to.be.true

Issue is that the above fails when the object returns a string value, AssertionError: expected false to be true. So im not sure where to go from here.

Thanks!

Try to.be.oneOf

Chai Assertion Library - oneof method

Testing for null or “string” isn’t straight forward.

However, its been discussed on the forum before.

const response = pm.response.json();

pm.test("model_image = string or null", () => {
    let model_image = response.model_image;
    pm.expect(Object.prototype.toString.call(model_image)).to.be.oneOf(["[object String]","[object Null]"])
});

Thank you so much, I did read over that and tried ut