I have a very simple interface type as follows
export interface Amount {
totalAmount: number;
}
And in my unit test I'm wanting to check the object returned from an API call is of this type but I'm nut sure how to do it. My API call is as follows:
const expectedResponse = {
totalAmount: 5000
};
amountDataService
.getAmountData(params)
.subscribe(
result => {
expect(result instanceof Amount).toBe(true);
expect(result).toEqual(expectedResponse);
},
error => {
fail('Data was not returned successfully.');
}
);
However the line expect(result instanceof Amount).toBe(true);
displays an error with the message:
'Amount' only refers to a type, but is being used as a value here
How can I check the type of the object returned?