Skip to content

Tests: no way ensuring that super has been called. #5629

@Izhaki

Description

@Izhaki

When writing tests (using Jasmine in my case), how can one ensure that the super of a class is called?

For instance, in the following code:

class Snake extends Animal {
    constructor(name: string) { super(name); }
    move(meters = 5) {
        alert("Slithering...");
        super.move(meters);
    }
}

How can one write a test ensuring super.move() is called when Snake.move() is called?

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions