velocious 1.0.73 → 1.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ export default class VelociousDatabaseQuery {
|
|
|
49
49
|
|
|
50
50
|
async count() {
|
|
51
51
|
// Generate count SQL
|
|
52
|
-
let sql =
|
|
52
|
+
let sql = `COUNT(${this.driver.quoteTable(this.modelClass.tableName())}.${this.driver.quoteColumn(this.modelClass.primaryKey())})`
|
|
53
53
|
|
|
54
54
|
if (this.driver.getType() == "pgsql") sql += "::int"
|
|
55
55
|
|
|
@@ -151,8 +151,8 @@ export default class VelociousDatabaseQuery {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
async first() {
|
|
154
|
-
const newQuery = this.clone()
|
|
155
|
-
const results = await newQuery.
|
|
154
|
+
const newQuery = this.clone().limit(1).reorder(this.modelClass.orderableColumn())
|
|
155
|
+
const results = await newQuery.toArray()
|
|
156
156
|
|
|
157
157
|
return results[0]
|
|
158
158
|
}
|
package/src/testing/test.js
CHANGED
|
@@ -225,6 +225,9 @@ class Expect {
|
|
|
225
225
|
|
|
226
226
|
for (const key in result) {
|
|
227
227
|
const value = result[key]
|
|
228
|
+
|
|
229
|
+
if (!(key in this._object)) throw new Error(`${this._object.constructor.name} doesn't respond to ${key}`)
|
|
230
|
+
|
|
228
231
|
const objectValue = this._object[key]()
|
|
229
232
|
|
|
230
233
|
if (value != objectValue) {
|