[Groonga-commit] nroonga/nroonga at eee9f30 [master] Add test when groonga got an error

Back to archive index

abetomo null+****@clear*****
Tue Sep 12 18:06:15 JST 2017


abetomo	2017-09-12 18:06:15 +0900 (Tue, 12 Sep 2017)

  New Revision: eee9f30d9d6bdba8fb29f45336ddffe06fa1e301
  https://github.com/nroonga/nroonga/commit/eee9f30d9d6bdba8fb29f45336ddffe06fa1e301

  Merged cfc981a: Merge pull request #22 from abetomo/add_test_when_groonga_got_an_error

  Message:
    Add test when groonga got an error

  Modified files:
    test/database.test.js

  Modified: test/database.test.js (+23 -0)
===================================================================
--- test/database.test.js    2017-09-12 18:05:48 +0900 (cce855d)
+++ test/database.test.js    2017-09-12 18:06:15 +0900 (4a4bce8)
@@ -142,6 +142,29 @@ describe('database whose name is not string', () => {
   })
 })
 
+describe('groonga error', () => {
+  const db = new nroonga.Database()
+  const invalidCommand = 'table_createeee'
+  const errorMessage = `invalid command name: ${invalidCommand}`
+
+  describe('#command', () => {
+    it('should be set error object', (done) => {
+      db.command(invalidCommand, {}, (err, data) => {
+        expect(err).to.be.an.instanceof(Error)
+        expect(err.message).to.equal(errorMessage)
+        expect(data).to.be.undefined
+        done()
+      })
+    })
+  })
+
+  describe('#commandSync', () => {
+    it('should raise an exception', () => {
+      expect(() => db.commandSync(invalidCommand, {})).to.throw(errorMessage)
+    })
+  })
+})
+
 describe('database with data stored', () => {
   it('should select records', done => {
     withTestDatabase(db => {
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20170912/0470999e/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index