export interface User {
name: string;
}
How can I unit test the above interface, so Karma could show it in the code coverage report?
I already tried creating the object and assert some properties, but didn't work. The test passes but karma doesn't consider it in the code coverage report.
import { User } from "./user";
describe('User', () => {
it('test', () => {
const obj: User = {
name: "xxx",
}
expect(obj.name).toEqual("xxx");
});
});
You can't. There is no code to cover here: nothing is executable.
And interfaces only exist at compile-time. They don't exist at runtime.