1
1
describe ( "SpeciesViewModel Spec" , function ( ) {
2
2
var request , result ;
3
- // jasmine.Ajax.install();
4
-
5
- // beforeEach(function() {
6
- // request = jasmine.Ajax.requests.mostRecent();
7
- // expect(request.method).toBe('GET');
8
- // });
9
3
it ( "Can participate in the DataModelItem calls like checkWarnings" , function ( ) {
10
4
var options = {
11
5
searchBieUrl : '/species/searchBie'
@@ -31,7 +25,7 @@ describe("SpeciesViewModel Spec", function () {
31
25
32
26
} ) ;
33
27
34
- describe ( "Test outputSpeciesId " , function ( ) {
28
+ describe ( "Test ajax call to supply new outSpeciesId " , function ( ) {
35
29
beforeEach ( function ( ) {
36
30
jasmine . Ajax . install ( ) ;
37
31
} ) ;
@@ -54,32 +48,10 @@ describe("SpeciesViewModel Spec", function () {
54
48
guid : 'New guid'
55
49
} ;
56
50
57
-
58
51
let options = { searchBieUrl : '/test/searchBie' , bieUrl : '/test/bie/' , getOutputSpeciesIdUrl : 'test/getOutputSpeciesIdUrl' }
59
52
let responseData = { outputSpeciesId : "666666" } ;
60
53
61
- // spyOn($, 'ajax').and.callFake(function () {
62
- // var d = $.Deferred();
63
- // d.resolve(responseData);
64
- // return d.promise();
65
- // });
66
-
67
-
68
-
69
-
70
-
71
54
let speciesViewModel = new SpeciesViewModel ( oldSpeciesSelectedData , options , { } ) ;
72
- // spyOn($, 'ajax').and.callFake(function () {
73
- // var d = $.Deferred();
74
- // d.resolve(responseData);
75
- // return d.promise();
76
- // });
77
-
78
- // request = jasmine.Ajax.requests.mostRecent();
79
- // request.respondWith({
80
- // status: 200,
81
- // responseJSON: responseData
82
- // });
83
55
84
56
speciesViewModel . loadData ( newSpeciesSelectedData ) ;
85
57
request = jasmine . Ajax . requests . filter ( 'test/getOutputSpeciesIdUrl' ) [ 0 ] ;
@@ -88,13 +60,9 @@ describe("SpeciesViewModel Spec", function () {
88
60
responseJSON : responseData
89
61
} ) ;
90
62
91
-
92
- // expect(request.url).toBe('test/getOutputSpeciesIdUrl');
63
+ expect ( request . url ) . toBe ( 'test/getOutputSpeciesIdUrl' ) ;
93
64
expect ( speciesViewModel . toJS ( ) . outputSpeciesId ) . toEqual ( responseData . outputSpeciesId )
94
-
95
65
expect ( speciesViewModel . outputSpeciesId ( ) ) . not . toEqual ( oldSpeciesSelectedData . outputSpeciesId ) ;
96
- // expect($.ajax).toHaveBeenCalled();
97
- // expect(speciesViewModel.toJS().outputSpeciesId).toEqual(responseData.outputSpeciesId);
98
66
99
67
} ) ;
100
68
} )
0 commit comments