wit-api icon indicating copy to clipboard operation
wit-api copied to clipboard

Unable to add a new value a an entity - return entity "not-found'

Open marrouchi opened this issue 6 years ago • 1 comments

Running unit tests returns :

nyc mocha --timeout 5000 --reporter nyan

17 --------------,------, 9 --------------| /_/\ 0 --------------^|__( x .x) -------------- "" ""

17 passing (43s) 9 failing

  1. Wit Entity services Get one entity by name Should fetch an Entity: Error: expected [Error: Not Found] to be falsy at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.ok (node_modules/expect.js/index.js:115:10) at Function.ok (node_modules/expect.js/index.js:499:17) at wit.entity.get.then.catch.e (test/test.js:53:31) at process._tickCallback (internal/process/next_tick.js:109:7)

  2. Wit Value services Should add a value: Error: expected [Error: expected [] to contain 'keywords'] to be falsy at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.ok (node_modules/expect.js/index.js:115:10) at Function.ok (node_modules/expect.js/index.js:499:17) at wit.value.add.then.catch.e (test/test.js:158:29) at process._tickCallback (internal/process/next_tick.js:109:7)

  3. Wit Expression services Should remove an expression: Error: expected [Error: expected { status: 400, body: 'This entity needs at least one of keywords or trait lookup to be able to delete expressions', code: 'bad-request' } to have a property 'deleted'] to be falsy at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.ok (node_modules/expect.js/index.js:115:10) at Function.ok (node_modules/expect.js/index.js:499:17) at wit.expression.delete.then.catch.e (test/test.js:192:29) at process._tickCallback (internal/process/next_tick.js:109:7)

  4. Wit Learning Train using one sample at a time Should yeild on a json response: Error: expected [Error: expected [Error: You tried to create 'wit$greetings'. Use POST /entities instead] to be falsy] to be falsy at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.ok (node_modules/expect.js/index.js:115:10) at Function.ok (node_modules/expect.js/index.js:499:17) at wit.train.then.catch.e (test/test.js:246:31) at process._tickCallback (internal/process/next_tick.js:109:7)

  5. Wit Text messages Test on a learned text Should respond by an Intent Object: Error: expected [Error: expected {} to not be empty] to be falsy at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.ok (node_modules/expect.js/index.js:115:10) at Function.ok (node_modules/expect.js/index.js:499:17) at wit.message.then.catch.e (test/test.js:283:31) at process._tickCallback (internal/process/next_tick.js:109:7)

  6. Wit Text messages Test on a forgotten text Should respond by an Intent Object containing greeting: Error: expected [Error: expected {} to not be empty] to be falsy at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.ok (node_modules/expect.js/index.js:115:10) at Function.ok (node_modules/expect.js/index.js:499:17) at wit.message.then.catch.e (test/test.js:301:31) at process._tickCallback (internal/process/next_tick.js:109:7)

  7. Wit Speech Should respond by an Intent Object: Error: expected [Error: expected 'Hello' to equal 'hello'] to be falsy at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.ok (node_modules/expect.js/index.js:115:10) at Function.ok (node_modules/expect.js/index.js:499:17) at wit.speech.then.catch.e (test/test.js:319:29) at process._tickCallback (internal/process/next_tick.js:109:7)

  8. Wit App Management Delete an App The latest wit instance shall not work Should trigger error: Error: expected [Error: expected { name: 'intent', id: '5b73fa2b-cf19-4591-a653-eb78a8dc719f', values: [], builtin: false, doc: 'User-defined entity', lang: 'en', lookups: [ 'trait' ], request: [Function] } to be falsy] to have a property 'code' at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.property (node_modules/expect.js/index.js:381:12) at newWit.entity.get.then.catch.e (test/test.js:406:31) at process._tickCallback (internal/process/next_tick.js:109:7)

  9. Wit Error handeling Api fails Should fail & return Error instance with a message and code props: Error: expected 'no-auth' to equal 'unknown' at Assertion.assert (node_modules/expect.js/index.js:96:13) at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10) at Assertion.(anonymous function) [as be] (node_modules/expect.js/index.js:69:24) at defectedWit.entity.list.then.catch.e (test/test.js:424:29) at process._tickCallback (internal/process/next_tick.js:109:7)

-----------------|----------|----------|----------|----------|-------------------|

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 80.22 56.76 80.77 80.15
wit-api 100 100 100 100
index.js 100 100 100 100
wit-api/src 88.78 59.18 95 88.72
Entity.js 93.18 84.62 100 93.02 47,74,78
Expression.js 85.71 50 100 85.71 27,31,42
Message.js 93.75 50 100 93.75 24
Sample.js 87.5 75 100 87.5 26,45,49
Speech.js 80 41.67 100 80 11,29,40,43,44,50
Value.js 85.71 33.33 100 85.71 29,33,44
Wit.js 92.5 66.67 57.14 92.5 53,58,63
wit-api/src/lib 57.33 52 33.33 57.33
App.js 100 66.67 100 100 1
Entity.js 33.33 33.33 9.09 33.33 ... 56,57,59,64,66
Intent.js 52.94 20 33.33 52.94 ... 11,13,14,15,18
requestAPI.js 85.71 87.5 100 85.71 5,11
----------------- ---------- ---------- ---------- ---------- -------------------
npm ERR! Test failed. See above for more details.

marrouchi avatar Aug 15 '18 10:08 marrouchi

After further investigation : Adding values applies only to keyword entities. See docs : wit http api

marrouchi avatar Aug 15 '18 19:08 marrouchi