jbrumwell / mock-knex

A mock knex adapter for simulating a database during testing
MIT License
239 stars 71 forks source link

Only returns one column from Db table for MSSQL select query #71

Closed sanjay-kanwar closed 7 years ago

sanjay-kanwar commented 7 years ago

Hi There, I have a simple knex query and when i run the test with mock-knex i am only getting one table field information instead of all fields where as when i run the knex mssql query same code against actual MSSQL Db it returns all table fields. Below attach is the sample query.

   knex
          .from(tableName)
          .where("TEST", "TEST")
          .select()
          .then((objInstance)=>{
             return objInstance
          })
sanjay-kanwar commented 7 years ago

Sorry i am closing this issue i have found the solution now. this is what i have to add to get the desired result

tracker.on("query", (query) => {
      if (query.method === "insert") {
        query.response([{ fileName: "filedValue" }]);
      }
    });