UNPKG

client-ui

Version:

Testing implementation of nodeJs Backend, angular frontend, and hopefully in a way that this can be deployed to s3/cloudfront

76 lines (70 loc) 2.72 kB
/* global describe beforeEach it angular inject assert */ config.company = { phone: { short: 9998887654 } }; describe("Shared Client", function() { var server = "http://qloans:8080/v1/"; var $controller; var $rootScope; var _ctrl; beforeEach(function() { angular.mock.module("clientApp", function($provide) { $provide.constant("rootConstants", { "server": server }); $provide.service("$state", function() { }); }); }); beforeEach(function() { inject(function($injector) { $controller = $injector.get("$controller"); $rootScope = $injector.get("$rootScope"); }); }); beforeEach(function() { _ctrl = $controller("accountCreationController", {"requiredDisclosures": {}, "$scope": $rootScope.$new()}); _ctrl.acform = { $invalid: false }; }); describe("state hard cuts", function() { it("should not allow loans in Iowa", function(){ assert.equal(_ctrl.errorMessage, false); _ctrl.userInput.client.personalInformation.state = "IA"; assert.equal(_ctrl.validState(), false); assert(_ctrl.errorMessage); }); it("should allow loans in Michigan", function(){ assert.equal(_ctrl.errorMessage, false); _ctrl.userInput.client.personalInformation.state = "MI"; assert.equal(_ctrl.validState(), true); assert.equal(_ctrl.errorMessage, false); }); }); describe("state minimums", function() { it("Minimum in georgia is 3000", function(){ assert.equal(_ctrl.errorMessage, false); _ctrl.userInput.loan.requestedAmount = 2500; _ctrl.userInput.client.personalInformation.state = "NM"; assert.equal(_ctrl.stateSpecificMinimumsMet(), false); assert(_ctrl.errorMessage); }); it("3000 in georgia is ok", function(){ assert.equal(_ctrl.errorMessage, false); _ctrl.userInput.loan.requestedAmount = 2501; _ctrl.userInput.client.personalInformation.state = "NM"; assert.equal(_ctrl.stateSpecificMinimumsMet(), true); assert.equal(_ctrl.errorMessage, false); }); it("2000 or above in michigan is ok", function(){ assert.equal(_ctrl.errorMessage, false); _ctrl.userInput.client.personalInformation.state = "MI"; _ctrl.userInput.loan.requestedAmount = 2000; assert.equal(_ctrl.stateSpecificMinimumsMet(), true); assert.equal(_ctrl.errorMessage, false); }); }); });