Skip to content

Commit a3b414e

Browse files
Merge pull request #263 from morphatic/fix-model-find
Fix model find
2 parents 3599e07 + 9c1b652 commit a3b414e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/service-module/make-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export default function makeModel(options: FeathersVuexOptions) {
164164
}
165165

166166
public static find(params) {
167-
this._dispatch('find', params)
167+
return this._dispatch('find', params)
168168
}
169169

170170
public static findInStore(params) {

test/service-module/model-methods.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,19 @@ describe('Models - Methods', function () {
134134
clearModels()
135135
})
136136

137-
it('Model.find', function () {
137+
it('Model.find is a function', function () {
138138
const { Task } = makeContext()
139139

140140
assert(typeof Task.find === 'function')
141141
})
142142

143+
it('Model.find returns a Promise', function () {
144+
const { Task } = makeContext()
145+
const result = Task.find()
146+
assert(typeof result.then !== 'undefined')
147+
result.catch(err => { /* noop -- prevents UnhandledPromiseRejectionWarning */})
148+
})
149+
143150
it('Model.findInStore', function () {
144151
const { Task } = makeContext()
145152

0 commit comments

Comments
 (0)