export class ExampleComponent {
public someVar: string;
constructor() {
this.someVar = "";
}
public someFunction() {
this.someVar = "Hello World";
}
}
describe("ExampleComponent", () => {
let component: ExampleComponent;
describe("When the component is initialized", () => {
beforeEach(() => {
component = new ExampleComponent();
});
it("should have a variable someVar that is empty"), () => {
expect(component.someVar).toEqual("");
});
describe("And when someFunction is called", () => {
beforeEach(() => {
component.someFunction();
});
it("should have a variable someVar that is 'Hello World'"), () => {
expect(component.someVar).toEqual("Hello World");
});
});
});
});