Skip to content

Mocking 'findByPk' not recognized by QueryInterface  #11

Description

@mgxmajewski

https://github.com/Foyer-Inc/sequelize-mock/blob/01663638baac97483fa75a62efa37bc3eb63c884/src/model.js#L412

Hi,

I'm having some issues mocking fakeModel while using 'findByPk' query.
I have changed query property value to "findByPk" in src/model.js and it works.
Guess double assignment on lines 407 and 408 doesn't solve the alias issue of findById and findByPk equivalance.

fakeModel.prototype.findById =
fakeModel.prototype.findByPk = async function (id) {
	var self = this;

	return await this.$query({
		query: "findByPk",

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions