Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Commit

Permalink
fix(test): fix broken unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
bohnen committed Aug 6, 2015
1 parent 48d7dc8 commit 3cbc4a0
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 41 deletions.
7 changes: 3 additions & 4 deletions config.js
@@ -1,5 +1,4 @@
System.config({
"defaultJSExtensions": true,
"transpiler": "babel",
"babelOptions": {
"optional": [
Expand All @@ -9,9 +8,9 @@ System.config({
]
},
"paths": {
"*": "dist/*",
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
"*": "dist/*.js",
"github:*": "jspm_packages/github/*.js",
"npm:*": "jspm_packages/npm/*.js"
}
});

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/dist/demo.spec.js
Expand Up @@ -11,7 +11,7 @@ describe('aurelia skeleton app', function () {
po_skeleton = new _skeletonPoJs.PageObject_Skeleton();
po_welcome = new _welcomePoJs.PageObject_Welcome();

browser.loadAndWaitForAureliaPage('http://localhost:9000');
browser.loadAndWaitForAureliaPage("http://localhost:9000");
});

it('should load the page and display the initial page title', function () {
Expand Down
8 changes: 4 additions & 4 deletions test/unit/app.spec.js
Expand Up @@ -28,14 +28,14 @@ describe('the App module', () => {
});

it('should have a welcome route', () => {
expect(sut.router.routes).toContain({ route: ['','welcome'], name: 'welcome', moduleId: './welcome', nav: true, title:'Welcome' });
expect(sut.router.routes).toContain({ route: ['','welcome'], name: 'welcome', moduleId: 'welcome', nav: true, title:'Welcome' });
});

it('should have a flickr route', () => {
expect(sut.router.routes).toContain({ route: 'flickr', name: 'flickr', moduleId: './flickr', nav: true, title:'Flickr' });
it('should have a users route', () => {
expect(sut.router.routes).toContain({ route: 'users', name: 'users', moduleId: 'users', nav: true, title:'Github Users' });
});

it('should have a child router route', () => {
expect(sut.router.routes).toContain({ route: 'child-router', name: 'child-router', moduleId: './child-router', nav: true, title:'Child Router' });
expect(sut.router.routes).toContain({ route: 'child-router', name: 'child-router', moduleId: 'child-router', nav: true, title:'Child Router' });
});
});
8 changes: 4 additions & 4 deletions test/unit/child-router.spec.js
Expand Up @@ -28,14 +28,14 @@ describe('the Child Router module', () => {
});

it('should have a welcome route', () => {
expect(sut.router.routes).toContain({ route: ['','welcome'], name: 'welcome', moduleId: './welcome', nav: true, title:'Welcome' });
expect(sut.router.routes).toContain({ route: ['','welcome'], name: 'welcome', moduleId: 'welcome', nav: true, title:'Welcome' });
});

it('should have a flickr route', () => {
expect(sut.router.routes).toContain({ route: 'flickr', name: 'flickr', moduleId: './flickr', nav: true, title:'Flickr' });
it('should have a users route', () => {
expect(sut.router.routes).toContain({ route: 'users', name: 'users', moduleId: 'users', nav: true, title:'Github Users' });
});

it('should have a child router route', () => {
expect(sut.router.routes).toContain({ route: 'child-router', name: 'child-router', moduleId: './child-router', nav: true, title:'Child Router' });
expect(sut.router.routes).toContain({ route: 'child-router', name: 'child-router', moduleId: 'child-router', nav: true, title:'Child Router' });
});
});
28 changes: 0 additions & 28 deletions test/unit/flickr.spec.js

This file was deleted.

30 changes: 30 additions & 0 deletions test/unit/users.spec.js
@@ -0,0 +1,30 @@
import {Users} from '../../src/users';

class HttpStub {
fetch(url) {
var response = this.itemStub;
this.url = url;
return new Promise((resolve) => {
resolve({ json: () => response });
})
}
configure(func){
}
}

describe('the Users module', () => {

it('sets fetch response to users', (done) => {
var http = new HttpStub(),
sut = new Users(http),
itemStubs = [1],
itemFake = [2];

http.itemStub = itemStubs;
sut.activate().then(() => {
expect(sut.users).toBe(itemStubs);
expect(sut.users).not.toBe(itemFake);
done();
});
});
});

0 comments on commit 3cbc4a0

Please sign in to comment.