class User {
constructor(details) {
const { firstname, lastname } = details;
this.firstname = firstname;
this.lastname = lastname;
}
get name() {
return `${this.firstname} ${this.lastname}`;
}
}
describe(“User”, () => {
test(“name returns full name”, () => {
const user = new User({ firstname: “John”, lastname: “Doe” });
expect(user.name).toBe(“John Doe”);
});

});

By admin

Leave a Reply

Your email address will not be published.