Skip to content

Commit

Permalink
fix: update tests to RFC232 style
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-north committed Aug 29, 2018
1 parent 4dd571b commit b75efe9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
17 changes: 8 additions & 9 deletions tests/acceptance/exercise-6-test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { test } from 'qunit';
import moduleForAcceptance from '../helpers/module-for-acceptance';
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import require from 'require';

if (
require.has('ember-fundamentals/routes/course') &&
!require.has('ember-network/fetch') &&
!require.has('fetch')
) {
moduleForAcceptance('Exercise 6 | Basic Routing Structure');
module('Exercise 6 | Basic Routing Structure', function(hooks) {
setupApplicationTest(hooks);

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

andThen(() => {
assert.equal(currentURL(), '/');
let $phoenixLink = find('ul a[href="/course/Phoenix%20Fundamentals"]');
assert.equal(
Expand Down Expand Up @@ -41,11 +42,9 @@ if (
.indexOf('Ember Basics') >= 0,
'Ember Basics is present in a link on the "/" page'
);
});

click('ul a[href="/course/Ember%20Basics"]');
await click('ul a[href="/course/Ember%20Basics"]');

andThen(() => {
assert.ok(find('h1').length > 0, 'At least one H1 on the page');
assert.ok(
find('h1.course-title').length > 0,
Expand Down
17 changes: 8 additions & 9 deletions tests/acceptance/exercise7-test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { test } from 'qunit';
import moduleForAcceptance from '../helpers/module-for-acceptance';
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import require from 'require';

if (
require.has('ember-fundamentals/routes/course') &&
(require.has('ember-network/fetch') || require.has('fetch'))
) {
moduleForAcceptance('Exercise 7 | Async Data');
module('Exercise 7 | Async Data', function(hooks) {
setupApplicationTest(hooks);

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

andThen(() => {
assert.equal(currentURL(), '/');
let $phoenixLink = find(
'ul a[href="/course/phoenix-fundamentals-f8c47eb"]'
Expand Down Expand Up @@ -42,11 +43,9 @@ if (
.indexOf('Ember Basics') >= 0,
'Ember Basics is present in a link on the "/" page'
);
});

click('ul a[href="/course/ember-basics-cf22ed3"]');
await click('ul a[href="/course/ember-basics-cf22ed3"]');

andThen(() => {
assert.ok(find('h1').length > 0, 'At least one H1 on the page');
assert.ok(
find('h1.course-title').length > 0,
Expand Down

0 comments on commit b75efe9

Please sign in to comment.