Skip to content

Commit

Permalink
chore: move routes for acceptance testing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlafroscia committed Feb 5, 2019
1 parent 84911bb commit e96d160
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
14 changes: 7 additions & 7 deletions tests/acceptance/observable-model-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ module("Acceptance | observable model", function(hooks) {
setupScheduler(hooks);

test("it handles multiple values over time", async function(assert) {
this.owner.lookup("route:observable-model").model = () => {
this.owner.lookup("route:testing/observable-model").model = () => {
return merge(
of(1),
of(2).pipe(delay(100, this.scheduler)),
of(3).pipe(delay(200, this.scheduler))
);
};

await visit("/observable-model");
await visit("/testing/observable-model");

assert.dom().hasText("1", "Model hook resolves with the initial value");

Expand All @@ -34,23 +34,23 @@ module("Acceptance | observable model", function(hooks) {
});

test("it takes the latest value if multiple are emitted before resolution", async function(assert) {
this.owner.lookup("route:observable-model").model = () => {
this.owner.lookup("route:testing/observable-model").model = () => {
return of(1, 2);
};

await visit("/observable-model");
await visit("/testing/observable-model");

assert.dom().hasText("2", "Model used the later value");
});

module("unsubscribing from later values", function(hooks) {
hooks.beforeEach(async function(assert) {
const route = this.owner.lookup("route:observable-model");
const route = this.owner.lookup("route:testing/observable-model");
route.model = () => {
return merge(of(1), of(2).pipe(delay(100, this.scheduler)));
};

await visit("/observable-model");
await visit("/testing/observable-model");

this.subscription = route[LATER_VALUE_SUBSCRIPTION];
td.replace(this.subscription, "unsubscribe");
Expand Down Expand Up @@ -81,7 +81,7 @@ module("Acceptance | observable model", function(hooks) {
});

test("when the model hook is refreshed", async function(assert) {
await visit("/observable-model?page=2");
await visit("/testing/observable-model?page=2");

assert.verify(
this.subscription.unsubscribe(),
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const Router = EmberRouter.extend({
});

Router.map(function() {
this.route('observable-model');
this.route("testing", function() {
this.route("observable-model");
});
});

export default Router;
19 changes: 10 additions & 9 deletions tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';
"use strict";

module.exports = function(environment) {
let ENV = {
modulePrefix: 'dummy',
modulePrefix: "dummy",
podModulePrefix: "dummy/pods",
environment,
rootURL: '/',
locationType: 'auto',
rootURL: "/",
locationType: "auto",
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
Expand All @@ -23,27 +24,27 @@ module.exports = function(environment) {
}
};

if (environment === 'development') {
if (environment === "development") {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}

if (environment === 'test') {
if (environment === "test") {
// Testem prefers this...
ENV.locationType = 'none';
ENV.locationType = "none";

// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;

ENV.APP.rootElement = '#ember-testing';
ENV.APP.rootElement = "#ember-testing";
ENV.APP.autoboot = false;
}

if (environment === 'production') {
if (environment === "production") {
// here you can enable a production-specific feature
}

Expand Down

0 comments on commit e96d160

Please sign in to comment.