|
| 1 | +// Potential User Class that requires testing |
| 2 | +class User { |
| 3 | + constructor(details) { |
| 4 | + const { firstname, lastname } = details |
| 5 | + this.firstname = firstname |
| 6 | + this.lastname = lastname |
| 7 | + } |
| 8 | + |
| 9 | + get name() { |
| 10 | + return `${this.firstname} ${this.lastname}` |
| 11 | + } |
| 12 | +} |
| 13 | + |
| 14 | +// Plain JavaScript function used for testing |
| 15 | +const nameTest = function () { |
| 16 | + // Define a user Object |
| 17 | + const userDetails = { |
| 18 | + firstname: 'Jane', |
| 19 | + lastname: 'Doe' |
| 20 | + } |
| 21 | + |
| 22 | + // Instantiate a new User |
| 23 | + const testUser = new User(userDetails) |
| 24 | + // Print out result of the test |
| 25 | + console.log('Username is correct: ', testUser.name === 'Jane sssDoe') |
| 26 | +} |
| 27 | + |
| 28 | +// Execute the test |
| 29 | +nameTest() |
| 30 | + |
| 31 | +// A real world user test flow could look like this |
| 32 | + |
| 33 | +// test('user signs up and changes email', () => { |
| 34 | + |
| 35 | + // 1. Signup using the form |
| 36 | + // - Fill out form fields and submit |
| 37 | + |
| 38 | + // 2. Navigate to settings |
| 39 | + // - Find correct navigation elements |
| 40 | + |
| 41 | + // 3. Change Value for Email |
| 42 | + // - Find email field |
| 43 | + // - Update Value |
| 44 | + // - Submit Form |
| 45 | + // Check Value is correct |
| 46 | + |
| 47 | + // 4. Signout |
| 48 | + // - Find Singout option |
| 49 | + // - Verify Singout worked |
| 50 | + |
| 51 | +// }) |
0 commit comments