Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmerrifield committed May 18, 2016
1 parent 54ac98d commit a438105
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/shared/syncer.test.js
Expand Up @@ -70,6 +70,24 @@ describe('syncer', function() {
request.should.have.been.calledWith(model.app.req, expectedRequestOptions)
});

it('should encode non-latin param values', function () {
model.set('id', 'президент');

var expectedRequestOptions = {
method: 'GET',
path: '/listings/%D0%BF%D1%80%D0%B5%D0%B7%D0%B8%D0%B4%D0%B5%D0%BD%D1%82',
query: { baz: { quux: 'doh' } },
headers: { foo: 'bar' },
api: 'foo',
body: {}
};

syncer.serverSync.call(model, 'read', model, options);

request.should.have.been.calledOnce;
request.should.have.been.calledWith(model.app.req, expectedRequestOptions)
});

it('should send the correct payload on PUT or POST requests', function () {
var expectedRequestOptions = {
method: 'PUT',
Expand Down Expand Up @@ -112,6 +130,24 @@ describe('syncer', function() {
request.should.have.been.calledWith(model.app.req, expectedRequestOptions)
});

it('should encode non-latin param values', function () {
model.set('id', 'президент');

var expectedRequestOptions = {
method: 'GET',
path: '/listings/%D0%BF%D1%80%D0%B5%D0%B7%D0%B8%D0%B4%D0%B5%D0%BD%D1%82',
query: { baz: { quux: 'doh' } },
headers: { foo: 'bar' },
api: 'foo',
body: {}
};

syncer.serverSync.call(model, 'read', model, options);

request.should.have.been.calledOnce;
request.should.have.been.calledWith(model.app.req, expectedRequestOptions)
});

it('should send the correct payload on PUT or POST requests', function () {
var expectedRequestOptions = {
method: 'PUT',
Expand Down

0 comments on commit a438105

Please sign in to comment.