-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New unit tests for characters service.
New way to define expected xhr responses. Repaired phantomjs installation. Added chrome launcher to ease debugging. Removed unused cordova plugins.
- Loading branch information
Showing
11 changed files
with
6,196 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
describe('charactersService: ', function () { | ||
|
||
var charactersService, $httpBackend; | ||
|
||
beforeEach(module('app')); | ||
|
||
beforeEach(inject(function ($injector) { | ||
charactersService = $injector.get('charactersService'); | ||
$httpBackend = $injector.get('$httpBackend'); | ||
})); | ||
|
||
afterEach(function() { | ||
$httpBackend.verifyNoOutstandingRequest(); | ||
}); | ||
|
||
it('should have 4 results', function (done) { | ||
var fixture = readJSON(fixturesPath + '/characters/Deadpool.json'); | ||
$httpBackend.expectGET(/\/characters/).respond(fixture); | ||
charactersService.findByName('Deadpool').then(function (results) { | ||
expect(results).toBeTruthy(); | ||
expect(results.length).toBe(4); | ||
done(); | ||
}); | ||
$httpBackend.flush(); | ||
}); | ||
|
||
it('should have multiple pages', function (done) { | ||
var fixture1 = readJSON(fixturesPath + '/characters/s_0.json'); | ||
var fixture2 = readJSON(fixturesPath + '/characters/s_20.json'); | ||
$httpBackend.expectGET(/\/characters/).respond(fixture1); | ||
$httpBackend.expectGET(/\/characters/).respond(fixture2); | ||
var prefix = 'sp'; | ||
var offset = 0; | ||
var list = []; | ||
charactersService.findByName(prefix).then(function (results) { | ||
expect(results).toBeTruthy(); | ||
expect(results.length).toBe(20); | ||
list = list.concat(results); | ||
}).then(function () { | ||
offset = 20; | ||
return charactersService.findByName(prefix, offset); | ||
}).then(function (results) { | ||
expect(results).toBeTruthy(); | ||
expect(results.length).toBe(13); | ||
expect(list[0].id).not.toBe(results[0].id); | ||
list = list.concat(results); | ||
expect(list.length).toBe(33); | ||
done(); | ||
}); | ||
$httpBackend.flush(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,81 @@ | ||
{ | ||
"name": "learning-ionic", | ||
"version": "0.3.0", | ||
"description": "Project to learn ionic of course", | ||
"devDependencies": { | ||
"autoprefixer": "^6.3.1", | ||
"bower": "^1.7.7", | ||
"grunt": "^0.4.5", | ||
"grunt-bump": "^0.7.0", | ||
"grunt-chokidar": "^1.0.0", | ||
"grunt-contrib-clean": "^0.7.0", | ||
"grunt-contrib-concat": "^0.5.1", | ||
"grunt-contrib-copy": "^0.8.2", | ||
"grunt-contrib-jade": "^0.15.0", | ||
"grunt-contrib-jshint": "^0.12.0", | ||
"grunt-contrib-uglify": "^0.11.0", | ||
"grunt-groc": "^0.6.0", | ||
"grunt-html2js": "^0.3.5", | ||
"grunt-jscs": "^2.6.0", | ||
"grunt-karma": "^0.12.1", | ||
"grunt-newer": "^1.1.1", | ||
"grunt-ng-annotate": "^1.0.1", | ||
"grunt-parallel": "^0.4.1", | ||
"grunt-plato": "^1.2.1", | ||
"grunt-postcss": "^0.7.1", | ||
"grunt-replace": "^0.11.0", | ||
"grunt-sass": "^1.1.0", | ||
"grunt-sass-compile-imports": "^0.2.1", | ||
"grunt-shell": "^1.1.2", | ||
"jasmine-core": "^2.4.1", | ||
"jit-grunt": "^0.9.1", | ||
"js-yaml": "^3.5.2", | ||
"jscs-stylish": "^0.3.1", | ||
"jshint-stylish": "^2.1.0", | ||
"karma": "^0.13.19", | ||
"karma-coverage": "^0.5.3", | ||
"karma-jasmine": "^0.3.6", | ||
"karma-junit-reporter": "^0.3.8", | ||
"karma-phantomjs-launcher": "^1.0.0", | ||
"load-grunt-configs": "^0.4.3", | ||
"lodash": "^4.0.1", | ||
"node.extend": "^1.1.5", | ||
"phantomjs": "^2.1.3", | ||
"shelljs": "^0.5.3", | ||
"time-grunt": "^1.3.0" | ||
}, | ||
"cordovaPlugins": [ | ||
"cordova-plugin-console", | ||
"cordova-plugin-crosswalk-webview", | ||
"cordova-plugin-device", | ||
"cordova-plugin-dialogs", | ||
"cordova-plugin-google-analytics", | ||
"cordova-plugin-statusbar", | ||
"cordova-plugin-whitelist", | ||
"ionic-plugin-keyboard", | ||
"cordova-plugin-splashscreen", | ||
{ | ||
"locator": "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git", | ||
"id": "cordova-plugin-x-toast" | ||
}, | ||
"cordova-plugin-network-information" | ||
], | ||
"cordovaPlatforms": [ | ||
"android", | ||
"ios" | ||
], | ||
"scripts": { | ||
"prestart": "npm install", | ||
"postinstall": "bower install", | ||
"start": "npm run serve", | ||
"serve": "grunt dev --mock true --proxy true && grunt serve --mock true --proxy true", | ||
"android": "grunt dev && ionic run android", | ||
"android-lr": "grunt dev --proxy true && grunt run:android -l --proxy true", | ||
"ios": "grunt dev && ionic run ios", | ||
"ios-lr": "grunt dev --proxy true && grunt run:ios -l --proxy true", | ||
"test": "grunt dev --mock true && grunt karma:dev", | ||
"wtest": "grunt dev --mock true && grunt parallel:wtest --mock true", | ||
"doc": "grunt clean:doc groc plato", | ||
"build": "grunt dev && ionic build" | ||
"name": "learning-ionic", | ||
"version": "0.3.0", | ||
"description": "Project to learn ionic of course", | ||
"devDependencies": { | ||
"autoprefixer": "^6.3.1", | ||
"bower": "^1.7.7", | ||
"grunt": "^0.4.5", | ||
"grunt-bump": "^0.7.0", | ||
"grunt-chokidar": "^1.0.0", | ||
"grunt-contrib-clean": "^0.7.0", | ||
"grunt-contrib-concat": "^0.5.1", | ||
"grunt-contrib-copy": "^0.8.2", | ||
"grunt-contrib-jade": "^0.15.0", | ||
"grunt-contrib-jshint": "^0.12.0", | ||
"grunt-contrib-uglify": "^0.11.0", | ||
"grunt-groc": "^0.6.0", | ||
"grunt-html2js": "^0.3.5", | ||
"grunt-jscs": "^2.6.0", | ||
"grunt-karma": "^0.12.1", | ||
"grunt-newer": "^1.1.1", | ||
"grunt-ng-annotate": "^1.0.1", | ||
"grunt-parallel": "^0.4.1", | ||
"grunt-plato": "^1.2.1", | ||
"grunt-postcss": "^0.7.1", | ||
"grunt-replace": "^0.11.0", | ||
"grunt-sass": "^1.1.0", | ||
"grunt-sass-compile-imports": "^0.2.1", | ||
"grunt-shell": "^1.1.2", | ||
"jasmine-core": "^2.4.1", | ||
"jit-grunt": "^0.9.1", | ||
"js-yaml": "^3.5.2", | ||
"jscs-stylish": "^0.3.1", | ||
"jshint-stylish": "^2.1.0", | ||
"karma": "^0.13.19", | ||
"karma-chrome-launcher": "^0.2.2", | ||
"karma-coverage": "^0.5.3", | ||
"karma-jasmine": "^0.3.6", | ||
"karma-junit-reporter": "^0.3.8", | ||
"karma-phantomjs-launcher": "^1.0.0", | ||
"load-grunt-configs": "^0.4.3", | ||
"lodash": "^4.0.1", | ||
"node.extend": "^1.1.5", | ||
"phantomjs": "^2.1.3", | ||
"phantomjs-prebuilt": "^2.1.4", | ||
"shelljs": "^0.5.3", | ||
"time-grunt": "^1.3.0" | ||
}, | ||
"cordovaPlugins": [ | ||
"cordova-plugin-console", | ||
"cordova-plugin-crosswalk-webview", | ||
"cordova-plugin-device", | ||
"cordova-plugin-google-analytics", | ||
"cordova-plugin-statusbar", | ||
"cordova-plugin-whitelist", | ||
"ionic-plugin-keyboard", | ||
"cordova-plugin-splashscreen", | ||
{ | ||
"locator": "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git", | ||
"id": "cordova-plugin-x-toast" | ||
} | ||
], | ||
"cordovaPlatforms": [ | ||
"android", | ||
"ios" | ||
], | ||
"scripts": { | ||
"prestart": "npm install", | ||
"postinstall": "bower install", | ||
"start": "npm run serve", | ||
"serve": "grunt dev --mock true --proxy true && grunt serve --mock true --proxy true", | ||
"android": "grunt dev && ionic run android", | ||
"android-lr": "grunt dev --proxy true && grunt run:android -l --proxy true", | ||
"ios": "grunt dev && ionic run ios", | ||
"ios-lr": "grunt dev --proxy true && grunt run:ios -l --proxy true", | ||
"test": "grunt dev --mock true && grunt karma:dev", | ||
"wtest": "grunt dev --mock true && grunt parallel:wtest --mock true", | ||
"doc": "grunt clean:doc groc plato", | ||
"build": "grunt dev && ionic build" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.