Skip to content

Commit 009824f

Browse files
committed
revert tests that casted models to any
1 parent 6c73938 commit 009824f

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,20 +221,19 @@ describe('makeModel / BaseModel', function () {
221221
plugins: [todosPlugin, tasksPlugin]
222222
})
223223
const { models } = myApi
224-
const anyModels = models as any
225224

226-
assert(anyModels.myApi.Todo === Todo)
227-
assert(!anyModels.theirApi.Todo, `Todo stayed out of the 'theirApi' namespace`)
228-
assert(anyModels.theirApi.Task === Task)
229-
assert(!anyModels.myApi.Task, `Task stayed out of the 'myApi' namespace`)
225+
assert(models.myApi.Todo === Todo)
226+
assert(!models.theirApi.Todo, `Todo stayed out of the 'theirApi' namespace`)
227+
assert(models.theirApi.Task === Task)
228+
assert(!models.myApi.Task, `Task stayed out of the 'myApi' namespace`)
230229

231230
assert.equal(
232-
anyModels.myApi.byServicePath[Todo.servicePath],
231+
models.myApi.byServicePath[Todo.servicePath],
233232
Todo,
234233
'also registered in models.byServicePath'
235234
)
236235
assert.equal(
237-
anyModels.theirApi.byServicePath[Task.servicePath],
236+
models.theirApi.byServicePath[Task.servicePath],
238237
Task,
239238
'also registered in models.byServicePath'
240239
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function makeContext() {
188188
class Item extends BaseModel {
189189
public static modelName = 'Item'
190190
public get todos() {
191-
return (BaseModel.models as any).Todo.findInStore({ query: {} }).data
191+
return BaseModel.models.Todo.findInStore({ query: {} }).data
192192
}
193193
public static instanceDefaults() {
194194
return {

test/utils.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ describe('Utils', function() {
8484
feathersClient,
8585
{ serverAlias: 'hydrate' }
8686
)
87-
const anyModels = models as any
8887

8988
class User extends BaseModel {
9089
public static modelName = 'User'
@@ -108,7 +107,7 @@ describe('Utils', function() {
108107
store.commit('users/addServerItem')
109108
assert(store.state.users.keyedById['abcdefg'], 'server document added')
110109
assert(store.state.users.keyedById['abcdefg'] instanceof Object, 'server document is pure javascript object')
111-
hydrateApi({ api: anyModels.hydrate })
110+
hydrateApi({ api: models.hydrate })
112111
assert(store.state.users.keyedById['abcdefg'] instanceof User, 'document hydrated')
113112
})
114113

0 commit comments

Comments
 (0)