-
Notifications
You must be signed in to change notification settings - Fork 23
/
LoginCtrl.spec.ts
40 lines (31 loc) · 938 Bytes
/
LoginCtrl.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {LoginCtrl} from "./../../../../src/module/auth/LoginCtrl";
import IProvideService = angular.auto.IProvideService;
describe("auth: LoginCtrl", () => {
let scope:any;
let login:LoginCtrl;
let fooBarMock:any;
beforeEach(module("app"));
beforeEach(module("app.auth"));
beforeEach(module(($provide:IProvideService) => {
fooBarMock = {
testMethod: sinon.stub()
};
$provide.value("fooBar", fooBarMock);
}));
beforeEach(inject(($rootScope, $controller) => {
scope = $rootScope.$new();
login = $controller("Login", {
$scope: scope
});
}));
it("concatenates title with suffix", () => {
// given
const title:string = "test-title";
const fooBarTitle:string = "example-title";
fooBarMock.testMethod.returns(title);
// when
const result:string = login.fooBarTitle(fooBarTitle);
// then
expect(result).equals(`${title}: ${fooBarTitle}`);
});
});