You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a few chai tests that call functions that should get a result back from my mock db tables, I'm trying to mock my SQL db using sequalize-mock so the tests won't fall over. I'm trying to add seed data to the mockDb so the tests can work with them, however, I keep getting this weird error:
SequelizeMockEmptyQueryQueueError: No query results are queued. Unexpected query attempted to be run
Any ideas why this happens?
Here is my mock db init which is running before each test.
exportconstinitializeMockDatabase=async()=>{constGlobalParam=awaitgenerateSqlSchema(dbMock,GLOBAL_PARAMS_SCHEMA,);constglobalParamsfilePath=path.resolve(__dirname,"../mocks/global_params.json",);constglobalParamsData=fs.readFileSync(globalParamsfilePath,"utf8");constglobalParams=JSON.parse(globalParamsData);// Loop through the globalParams object and create recordsfor(constkeyofObject.keys(globalParams)){constglobalParam=GlobalParam.build({name: key,value: globalParams[keyaskeyoftypeofglobalParams],});awaitglobalParam.save();}};
before(asyncfunction(){this.timeout(90*1000);chai.use(spies);chai.use(chaiAsPromised);constprojectId=MiscConstants.PROJECT_ID.TEST;process.env.GCLOUD_PROJECT=projectId;process.env.LOCAL_PUBSUB=true;awaitMocks.setup();Mocks.enable();// Initialize the mock databaseawaitinitializeMockDatabase();// Require all pub-subsrequire("firebase-functions").registerFunctions(require("../../index"));//await Emulators.setupEmulators();});
I have a few chai tests that call functions that should get a result back from my mock db tables, I'm trying to mock my SQL db using
sequalize-mock
so the tests won't fall over. I'm trying to add seed data to the mockDb so the tests can work with them, however, I keep getting this weird error:SequelizeMockEmptyQueryQueueError: No query results are queued. Unexpected query attempted to be run
Any ideas why this happens?
Here is my mock db init which is running before each test.
This is glboally available in SQL Mock file
And then in the before:
And executing queries like:
Any ideas? What I'm missing?
The text was updated successfully, but these errors were encountered: