You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2020/02/13 14:23:40 UTC

[couchdb-nano] 01/03: added test to fetch local docs

This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch localdocs
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git

commit ea494bed82db5e20524c5463b910302bb2abd1c9
Author: Glynn Bird <gl...@gmail.com>
AuthorDate: Thu Feb 13 14:17:27 2020 +0000

    added test to fetch local docs
---
 test/document.get.test.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/document.get.test.js b/test/document.get.test.js
index 6fba869..bcd127e 100644
--- a/test/document.get.test.js
+++ b/test/document.get.test.js
@@ -91,3 +91,17 @@ test('should detect missing parameters (callback) - db.get', () => {
     })
   })
 })
+
+test('check request can fetch local documents - db.get', async () => {
+  // mocks
+  const response = { _id: '_local/id', _rev: '1-123', a: 1 }
+  const scope = nock(COUCH_URL)
+    .get('/db/_local/id')
+    .reply(200, response)
+
+  // test GET /db/_local/id
+  const db = nano.db.use('db')
+  const p = await db.get('_local/_id')
+  expect(p).toStrictEqual(response)
+  expect(scope.isDone()).toBe(true)
+})