-
Notifications
You must be signed in to change notification settings - Fork 73
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
findOne() saving over table variable #69
Comments
I have the same problem! |
Same problem, the findOne seems to be creating the record if it doesn't exist and returns it, my code: workerController
spec
Results in the following output:
|
Never mind, found this in the code base for findById: /**
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the following code and I think there's an issue with the findOne() method because it saves over my table variable in my testing with Jest.
const SequelizeMock = require('sequelize-mock'); let dbMock = new SequelizeMock(); let UserMock = dbMock.define('test', { test: 'test', name: 'no' }
describe('Sequelize Model Testing',() => { test('testingggg', async () => { let user = await UserMock.findOne({ where: { name: 'amber' } }) expect(user.name).toBe('amber'); }) })
The expect user.name should be 'no' but its returning as 'amber'.
The text was updated successfully, but these errors were encountered: