@@ -20,16 +20,21 @@ describe('BWMonApp.UsageByMonth module, ', function() {
2020
2121 describe ( 'UsageByMonthController controller ' , function ( ) {
2222 var controller ,
23+ years = [ '2011' , '2012' ] ,
2324 usageData = {
2425 data : [
2526 { usage : 5 , total : 10 } ,
2627 { usage : 2 , total : 11 } ,
2728 { usage : 1 , total : 12 }
2829 ]
2930 } ,
31+ chartTypes = [
32+ [ 'type1' ] ,
33+ [ 'type2' ]
34+ ] ,
3035 chartOptions = {
3136 series : [ {
32- type : 'type'
37+ type : chartTypes [ 0 ]
3338 } ]
3439 } ,
3540 chartData = {
@@ -44,9 +49,11 @@ describe('BWMonApp.UsageByMonth module, ', function() {
4449
4550 beforeEach ( inject ( function ( _$controller_ , _dataService_ , _chartService_ ) {
4651 dataService = _dataService_ ;
52+ spyOn ( dataService , 'getYears' ) . and . returnValue ( years ) ;
4753 spyOn ( dataService , 'getUsageByMonth' ) . and . returnValue ( usageData ) ;
4854
4955 chartService = _chartService_ ;
56+ spyOn ( chartService , 'getChartTypes' ) . and . returnValue ( chartTypes ) ;
5057 spyOn ( chartService , 'getChartOptions' ) . and . returnValue ( chartOptions ) ;
5158 spyOn ( chartService , 'getChartData' ) . and . returnValue ( chartData ) ;
5259
@@ -59,6 +66,14 @@ describe('BWMonApp.UsageByMonth module, ', function() {
5966 scope . usageByMonthCtrl = controller ;
6067 } ) ) ;
6168
69+ it ( 'should set selected year' , function ( ) {
70+ expect ( controller . selected . year ) . toBe ( years [ 0 ] ) ;
71+ } ) ;
72+
73+ it ( 'should set selected chart type' , function ( ) {
74+ expect ( controller . selected . chartType ) . toBe ( chartTypes [ 0 ] ) ;
75+ } ) ;
76+
6277 it ( 'should set predicate to id' , function ( ) {
6378 expect ( controller . predicate ) . toEqual ( 'id' ) ;
6479 } ) ;
0 commit comments