Skip to content

Commit

Permalink
Update Fastboot tests to not use docs routes
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAstapov committed Sep 25, 2024
1 parent 12cb6ad commit 84ce9b1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/dummy/app/pods/examples/index/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>FastbootTesting</h1>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export default class extends Route {
@service router;

redirect() {
this.router.replaceWith('/');
this.router.replaceWith('/examples');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export default class extends Route {
@service router;

redirect() {
this.router.transitionTo('/');
this.router.transitionTo('/examples');
}
}
6 changes: 3 additions & 3 deletions tests/fastboot/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ module('Fastboot | basic', function (hooks) {
setup(hooks);

test('it renders the correct h1 title', async function (assert) {
await visit('/');
await visit('/examples');

assert.dom('h1').includesText('FastbootTesting');
});

test('it renders the correct og:title', async function (assert) {
let { htmlDocument } = await visit('/');
let { htmlDocument } = await visit('/examples');

assert
.dom('meta[property="og:title"]', htmlDocument)
.hasAttribute('content', 'Fastboot testing');
});

test('it gets a success response code', async function (assert) {
let { statusCode } = await visit('/');
let { statusCode } = await visit('/examples');

assert.strictEqual(statusCode, 200);
});
Expand Down
8 changes: 4 additions & 4 deletions tests/fastboot/redirects-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module('FastBoot | redirects test', function (hooks) {
);

assert.strictEqual(statusCode, 307);
assert.strictEqual(url, '/');
assert.deepEqual(headers.location, [`//${window.location.host}/`]);
assert.strictEqual(url, '/examples');
assert.deepEqual(headers.location, [`//${window.location.host}/examples`]);
});

test('redirects with a replace with', async function (assert) {
Expand All @@ -20,7 +20,7 @@ module('FastBoot | redirects test', function (hooks) {
);

assert.strictEqual(statusCode, 307);
assert.strictEqual(url, '/');
assert.deepEqual(headers.location, [`//${window.location.host}/`]);
assert.strictEqual(url, '/examples');
assert.deepEqual(headers.location, [`//${window.location.host}/examples`]);
});
});

0 comments on commit 84ce9b1

Please sign in to comment.