First pass at testing

- Unit/Integration(ish) tests for Home Controller
- Simple test for the date filter
- Dependencies for Karma and Jasmine
- circle.yml file for CI
This commit is contained in:
Lev Lazinskiy
2017-01-20 13:58:10 -08:00
parent dd49a0169d
commit 3d2e571efa
5 changed files with 159 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
describe("app.frontend", function() {
beforeEach(module('app.frontend'));
describe('Home Controller', function() {
var scope;
beforeEach(inject(function($rootScope, $controller, modelManager) {
scope = $rootScope.$new();
$modelManager = modelManager;
$controller("HomeCtrl", {
$scope: scope,
});
}));
it('should have a body class', function() {
expect(scope.bodyClass).toEqual('app-body-class');
});
it('should have an All tag', function() {
expect(scope.allTag).toBeDefined();
expect(scope.allTag.title).toEqual("All");
});
it('should have notes and tags model managers', function() {
expect($modelManager.tags).toBeDefined();
expect($modelManager.notes).toBeDefined();
});
it('should be able to add a new tag', function() {
scope.tagsAddNew("testTag");
expect($modelManager.items).toContain("testTag");
});
});
});

View File

@@ -0,0 +1,19 @@
describe("date filter", function() {
beforeEach(module('app.frontend'));
var $filter;
beforeEach(inject(function(_$filter_){
$filter = _$filter_;
}));
it('returns a defined time', function() {
var date = $filter('appDate');
expect(date(Date())).toBeDefined();
});
it('returns time', function() {
var dateTime = $filter('appDateTime');
expect(dateTime(Date())).toBeDefined();
});
});