Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validation error #59

Open
davidcostadev opened this issue Jul 16, 2019 · 0 comments
Open

Improve validation error #59

davidcostadev opened this issue Jul 16, 2019 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@davidcostadev
Copy link
Owner

davidcostadev commented Jul 16, 2019

Description:

When try to simulate error on one-has-many I get this error:

Error: WHERE parameter "id" has invalid "undefined" value
        at MySQLQueryGenerator.whereItemQuery (/Users/davidcosta/workplace/withmoney-api/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2063:13)
        at Utils.getComplexKeys.forEach.prop (/Users/davidcosta/workplace/withmoney-api/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2052:25)
        at Array.forEach (<anonymous>)
        at MySQLQueryGenerator.whereItemsQuery (/Users/davidcosta/workplace/withmoney-api/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2050:35)
        at MySQLQueryGenerator.getWhereConditions (/Users/davidcosta/workplace/withmoney-api/node_modules/sequelize/lib/dialects/abstract/query-generator.js:2462:19)
        at MySQLQueryGenerator.selectQuery (/Users/davidcosta/workplace/withmoney-api/node_modules/sequelize/lib/dialects/abstract/query-generator.js:1283:28)
        at QueryInterface.select (/Users/davidcosta/workplace/withmoney-api/node_modules/sequelize/lib/query-interface.js:1121:27)
        at Promise.try.then.then.then (/Users/davidcosta/workplace/withmoney-api/node_modules/sequelize/lib/model.js:1755:34)
        at tryCatcher (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/util.js:16:23)
        at Promise._settlePromiseFromHandler (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/promise.js:512:31)
        at Promise._settlePromise (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/promise.js:569:18)
        at Promise._settlePromise0 (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/promise.js:614:10)
        at Promise._settlePromises (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/promise.js:694:18)
        at _drainQueueStep (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/async.js:138:12)
        at _drainQueue (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/async.js:131:9)
        at Async.Object.<anonymous>.Async._drainQueues (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/async.js:147:5)
        at Immediate.Async.drainQueues (/Users/davidcosta/workplace/withmoney-api/node_modules/bluebird/js/release/async.js:17:14)
        at runCallback (timers.js:810:20)
        at tryOnImmediate (timers.js:768:5)
        at processImmediate [as _immediateCallback] (timers.js:745:5)

My test:

it.only('get a error listing accounts by user', async () => {
    await Controller.accounts(reqMock, resMock);

    expect(resMock.status).toBeCalled();
    expect(resMock.send).toBeCalled();
    expect(resMock.status.mock.calls[0][0]).toEqual(404);
  });
@davidcostadev davidcostadev added the bug Something isn't working label Aug 14, 2019
@davidcostadev davidcostadev added this to the v2 milestone Sep 20, 2019
@davidcostadev davidcostadev added the help wanted Extra attention is needed label Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant