Skip to content

Commit

Permalink
(#3862) - add putAttachment() test
Browse files Browse the repository at this point in the history
Based on a SO question, I was worried
that we didn't support the case where `putAttachment()`
is creating a new document with a base64 string.
But it seems to work.
  • Loading branch information
nolanlawson authored and marten-de-vries committed May 23, 2015
1 parent 3bcdefc commit 6a31c99
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/integration/test.attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,17 @@ adapters.forEach(function (adapter) {
});
});

it('putAttachment in new doc with base64', function () {
var db = new PouchDB(dbs.name, {auto_compaction: false});

return db.putAttachment('foo', 'att', 'Zm9v', 'text/plain').then(function () {
return db.get('foo', {attachments: true});
}).then(function (doc) {
doc._attachments['att'].content_type.should.match(/^text\/plain/);
doc._attachments['att'].data.should.equal('Zm9v');
});
});

it('#2818 - save same attachment in different revs', function () {
var db = new PouchDB(dbs.name, {auto_compaction: false});

Expand Down

0 comments on commit 6a31c99

Please sign in to comment.