mercredi 4 avril 2018

Testing Node.js API that uses Sequelize with Mocha/Expect/Supertest

I have been working on nodejs API that works with postgres and i have an issue for now when i wrote the test using expect, but i believe it will happen in future again when i will be using the API. Sequelize is returning all fields no matter what the type is a string value. When using ".toMatchObject" error is thrown because in original object and in database id is a numeric value, but is returned as a string. Same happens with decimal. Is there a way to get data how its stored, not as string? Is there different way to check if objects match without having to parse each attribute to be same type as original ?

I tried using raw:true as i read online, but it didnt work. Node version is 9.9, expect version is 22.4.3, sequelize version is 4.37

Thank you for help

Aucun commentaire:

Enregistrer un commentaire