Skip to content

Commit

Permalink
add acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kalsmic committed Sep 11, 2023
1 parent 2814f54 commit 0b6e688
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ export default class Router extends EmberRouter {
Router.map(function () {
this.route('about');
this.route('contact', {path:'/getting-in-touch'});
this.route('contact');

});
2 changes: 1 addition & 1 deletion app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="jumbo">
<div class="right tomster"></div>
<h2>Welcome to super Rentals</h2>
<h2>Welcome to Super Rentals!</h2>
<p>We hope you find exactly what you're looking for in a place to stay.</p>
<LinkTo @route="about" class="button">
About Us
Expand Down
43 changes: 43 additions & 0 deletions tests/acceptance/super-rentals-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { module, test } from 'qunit';
import { click, visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'super-rentals/tests/helpers';

module('Acceptance | super rentals', function (hooks) {
setupApplicationTest(hooks);

test('visiting /', async function (assert) {
await visit('/');

assert.strictEqual(currentURL(), '/');
assert.dom('h2').hasText('Welcome to Super Rentals!');

assert.dom('.jumbo a.button').hasText('About Us');
await click('.jumbo a.button');

assert.strictEqual(currentURL(), '/about');
});

test('visiting /about', async function (assert) {
await visit('/about');

assert.strictEqual(currentURL(), '/about');
assert.dom('h2').hasText('About Super Rentals');

assert.dom('.jumbo a.button').hasText('Contact Us');
await click('.jumbo a.button');

assert.strictEqual(currentURL(), '/getting-in-touch');
});

test('visiting /getting-in-touch', async function (assert) {
await visit('/getting-in-touch');

assert.strictEqual(currentURL(), '/getting-in-touch');
assert.dom('h2').hasText('Contact Us');

assert.dom('.jumbo a.button').hasText('About');
await click('.jumbo a.button');

assert.strictEqual(currentURL(), '/about');
});
});

0 comments on commit 0b6e688

Please sign in to comment.