From b45f993fc2358b31457dd87d32a3f8a92f035ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Ko=C5=82odziejski?= Date: Fri, 12 Apr 2013 23:49:41 +0200 Subject: [PATCH] (#682) - test putting unencoded attachment --- tests/test.attachments.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test.attachments.js b/tests/test.attachments.js index 4f19b97080..0dfe7cd819 100644 --- a/tests/test.attachments.js +++ b/tests/test.attachments.js @@ -303,6 +303,26 @@ adapters.map(function(adapter) { }); }); }); + + asyncTest("Try to insert a doc with unencoded attachment", function() { + initTestDB(this.name, function(err, db) { + var doc = { + _id: "foo", + _attachments: { + "foo.txt": { + content_type: "text/plain", + data: "this should have been encoded!" + } + } + }; + db.put(doc, function(err, res) { + ok(err, "error returned"); + strictEqual(err.status, 500, "correct error"); + strictEqual(err.error, "badarg", "correct error"); + start(); + }); + }); + }); });