Skip to content

Commit f70f1b0

Browse files
committed
add test for overlapping redirects
1 parent 3da161b commit f70f1b0

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

test/solidus.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,22 @@ describe( 'Solidus', function(){
8787
from: '/past-redirect',
8888
to: '/'
8989
}];
90-
var combined_redirects = JSON.stringify( original_redirects_arr.concat( temporal_redirects ) );
90+
var overlapping_redirects = [{
91+
start: moment().add( 's', 5 ).format( redirect_date_format ),
92+
from: '/overlapping-redirect',
93+
to: '/overlapping-redirect-future'
94+
}, {
95+
start: moment().subtract( 's', 5 ).format( redirect_date_format ),
96+
end: moment().add( 's', 5 ).format( redirect_date_format ),
97+
from: '/overlapping-redirect',
98+
to: '/overlapping-redirect-current'
99+
}, {
100+
start: moment().subtract( 's', 10 ).format( redirect_date_format ),
101+
end: moment().subtract( 's', 5 ).format( redirect_date_format ),
102+
from: '/overlapping-redirect',
103+
to: '/overlapping-redirect-past'
104+
}];
105+
var combined_redirects = JSON.stringify( original_redirects_arr.concat( temporal_redirects, overlapping_redirects ) );
91106
fs.writeFileSync( 'redirects.json', combined_redirects, DEFAULT_ENCODING );
92107
solidus_server = solidus.start({
93108
log_level: 0,
@@ -323,6 +338,9 @@ describe( 'Solidus', function(){
323338
},
324339
function( callback ){
325340
s_request.get('/future-redirect').expect( 404, callback );
341+
},
342+
function( callback ){
343+
s_request.get('/overlapping-redirect').expect( 'location', '/overlapping-redirect-current', callback );
326344
}
327345
], function( err, results ){
328346
if( err ) throw err;

0 commit comments

Comments
 (0)