@@ -18,6 +18,7 @@ describe('search', function () {
18
18
scope = $rootScope ;
19
19
$compile ( elm ) ( scope ) ;
20
20
scope . $digest ( ) ;
21
+ scope . testTime = new Date ( ) . valueOf ( ) ;
21
22
} ) ) ;
22
23
23
24
describe ( 'form generation' , function ( ) {
@@ -38,7 +39,7 @@ describe('search', function () {
38
39
describe ( 'results list' , function ( ) {
39
40
40
41
it ( 'displays one result when there is one' , function ( ) {
41
- $httpBackend . whenGET ( ' /api/search?q=hello' ) . respond ( { results : [
42
+ $httpBackend . whenGET ( ` /api/search?q=hello&sentAt= ${ scope . testTime } ` ) . respond ( { results : [
42
43
{ id : '1' , resource : 'resource' , resourceText : 'Resource' , text : 'Hello 1' }
43
44
] } ) ;
44
45
scope . searchTarget = 'hello' ;
@@ -49,7 +50,7 @@ describe('search', function () {
49
50
} ) ;
50
51
51
52
it ( 'displays two results when there are two' , function ( ) {
52
- $httpBackend . whenGET ( ' /api/search?q=hello' ) . respond ( { results : [
53
+ $httpBackend . whenGET ( ` /api/search?q=hello&sentAt= ${ scope . testTime } ` ) . respond ( { results : [
53
54
{ id : '1' , resource : 'resource' , resourceText : 'Resource' , text : 'Hello 1' } ,
54
55
{ id : '2' , resource : 'resource' , resourceText : 'Resource' , text : 'Hello 2' }
55
56
] } ) ;
@@ -63,7 +64,7 @@ describe('search', function () {
63
64
} ) ;
64
65
65
66
it ( 'should have an error class in the search box when the string is not found' , function ( ) {
66
- $httpBackend . whenGET ( ' /api/search?q=hello' ) . respond ( { results : [ ] } ) ;
67
+ $httpBackend . whenGET ( ` /api/search?q=hello&sentAt= ${ scope . testTime } ` ) . respond ( { results : [ ] } ) ;
67
68
scope . searchTarget = 'hello' ;
68
69
scope . $digest ( ) ;
69
70
$httpBackend . flush ( ) ;
@@ -77,7 +78,7 @@ describe('search', function () {
77
78
} ) ;
78
79
79
80
it ( 'formats results' , function ( ) {
80
- $httpBackend . whenGET ( ' /api/search?q=hello' ) . respond ( { ' results' : [
81
+ $httpBackend . whenGET ( ` /api/search?q=hello&sentAt= ${ scope . testTime } ` ) . respond ( { results : [
81
82
{ 'resource' : 'f_nested_schema' , 'resourceText' : 'Exams' , 'id' : '51c583d5b5c51226db418f15' , 'text' : 'Brown, John' , 'searchImportance' : 99 } ,
82
83
{ 'resource' : 'f_nested_schema' , 'resourceText' : 'Exams' , 'id' : '51c583d5b5c51226db418f17' , 'text' : 'Brown, Jenny' , 'searchImportance' : 99 }
83
84
] , 'moreCount' : 0 } ) ;
@@ -93,7 +94,7 @@ describe('search', function () {
93
94
} ) ;
94
95
95
96
it ( 'should focus on the first result returned' , function ( ) {
96
- $httpBackend . whenGET ( ' /api/search?q=hello' ) . respond ( { ' results' : [
97
+ $httpBackend . whenGET ( ` /api/search?q=hello&sentAt= ${ scope . testTime } ` ) . respond ( { results : [
97
98
{ 'resource' : 'f_nested_schema' , 'resourceText' : 'Exams' , 'id' : '51c583d5b5c51226db418f15' , 'text' : 'Brown, John' , 'searchImportance' : 99 } ,
98
99
{ 'resource' : 'f_nested_schema' , 'resourceText' : 'Exams' , 'id' : '51c583d5b5c51226db418f17' , 'text' : 'Brown, Jenny' , 'searchImportance' : 99 }
99
100
] , 'moreCount' : 0 } ) ;
@@ -165,7 +166,7 @@ describe('search', function () {
165
166
} ) ;
166
167
167
168
it ( 'should clear the target and the reults when Esc is pressed' , function ( ) {
168
- $httpBackend . whenGET ( ' /api/search?q=hello' ) . respond ( { ' results' : [
169
+ $httpBackend . whenGET ( ` /api/search?q=hello&sentAt= ${ scope . testTime } ` ) . respond ( { results : [
169
170
{ 'resource' : 'f_nested_schema' , 'resourceText' : 'Exams' , 'id' : '51c583d5b5c51226db418f15' , 'text' : 'Brown, John' , 'searchImportance' : 99 } ,
170
171
{ 'resource' : 'f_nested_schema' , 'resourceText' : 'Exams' , 'id' : '51c583d5b5c51226db418f17' , 'text' : 'Brown, Jenny' , 'searchImportance' : 99 }
171
172
] , 'moreCount' : 0 } ) ;
@@ -179,5 +180,4 @@ describe('search', function () {
179
180
180
181
} ) ;
181
182
182
-
183
183
} ) ;
0 commit comments