Skip to content
Myr

More mergeParam() specs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 5c4a356 · Browse files · 2 files+11 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−12 removed

  • tests:+10 added−1 removed
  • other:+1 added−11 removed

2 files+11 added−12 removed

modified:lib/express/utils.js+1 added-11 removed
modified:spec/spec.utils.js+10 added-1 removed
67 unmodified lines
68 params.user.email.should.eql 'tj@vision-media.ca'69 end70 end71 72 describe 'with an object as value'73 it 'should preserve it'74 params = {}75 utils.mergeParam('images[]', { name: '1' }, params)76 utils.mergeParam('images[]', { name: '2' }, params)77 params.images.should.eql [{ name: '1', name: '2' }]78 end79 end80 81 describe 'key[number]'82 it 'should merge correctly'83 params = { images: { one: 'foo.png' }}84 utils.mergeParam('images[0]', 'bar.png', params)
18 unmodified lines
103 params.images.should.eql ['foo.png', '1']104 end105 end106 98 describe 'with an object'107 describe 'with several merges'108 it 'should push values'109 params = {}110 utils.mergeParam('images[]', '1', params)111 utils.mergeParam('images[]', '2', params)
18 unmodified lines