February 2019
Beginner
694 pages
18h 4m
English
Our first set of unit tests will need to verify that the App class (our entry point) has been constructed correctly. When the application is first loaded, it will render a title, three buttons, and also indicate that no item has been selected. These HTML elements are bound to the Title, SelectedItem and items properties of the App class itself. Let's create an app.spec.ts file in the /test/unit directory, and write a test to verify that these properties have been set correctly, as follows:
describe('/test/unit/app.spec.ts : App tests', () => {
let app: App;
beforeAll(() => {
app = new App();
});
it('should set Title property ', () => {
expect(app.Title).toBe('Please select :');
});
});
The first line of this test uses ...
Read now
Unlock full access