Skip to content

Commit

Permalink
Add tests for FastBoot usage
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlafroscia committed Apr 3, 2018
1 parent d18b518 commit 8fda980
Show file tree
Hide file tree
Showing 7 changed files with 449 additions and 42 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- 6
- 8

sudo: false
dist: trusty
Expand All @@ -28,6 +26,7 @@ env:
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default
- EMBER_TRY_SCENARIO=fastboot-addon-tests

matrix:
fast_finish: true
Expand Down
4 changes: 4 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ module.exports = function() {
npm: {
devDependencies: {}
}
},
{
name: 'fastboot-addon-tests',
command: 'ember fastboot:test'
}
]
};
Expand Down
12 changes: 12 additions & 0 deletions fastboot-tests/fixtures/fastboot/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
location: config.locationType,
rootURL: config.rootURL
});

Router.map(function() {
});

export default Router;
9 changes: 9 additions & 0 deletions fastboot-tests/fixtures/fastboot/app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{#step-manager as |w|}}
{{#w.step}}
<h1>First Step</h1>
{{/w.step}}

{{#w.step}}
<h1>Second Step</h1>
{{/w.step}}
{{/step-manager}}
22 changes: 22 additions & 0 deletions fastboot-tests/index-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-env node, mocha */

'use strict';

const expect = require('chai').expect;
const setupTest = require('ember-fastboot-addon-tests').setupTest;

describe('FastBoot', function() {
setupTest('fastboot');

it('renders the initially visible step', async function() {
const res = await this.visit('/');
const { jQuery: jq, response } = res;

expect(response.statusCode).to.equal(200);
expect(
jq('h1')
.text()
.trim()
).to.equal('First Step');
});
});
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@ember/test-helpers": "^0.7.18",
"broccoli-asset-rev": "^2.5.0",
"chai": "^4.1.2",
"ember-cli": "~3.0.0",
"ember-cli-addon-docs": "^0.3.0",
"ember-cli-addon-docs-yuidoc": "^0.1.0",
Expand All @@ -34,6 +35,7 @@
"ember-cli-deploy-git-ci": "^1.0.1",
"ember-cli-document-title": "^0.3.3",
"ember-cli-eslint": "^4.2.3",
"ember-cli-fastboot": "^1.1.4-beta.1",
"ember-cli-inject-live-reload": "^1.7.0",
"ember-cli-qunit": "^4.3.2",
"ember-cli-shims": "^1.2.0",
Expand All @@ -46,6 +48,7 @@
"ember-css-modules": "^0.7.10",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.0",
"ember-fastboot-addon-tests": "^0.4.0",
"ember-hook": "^1.4.2",
"ember-load-initializers": "^1.0.0",
"ember-maybe-import-regenerator": "^0.1.6",
Expand Down
Loading

0 comments on commit 8fda980

Please sign in to comment.