userService in profileContact instead of rs
parent
5b0eb71fb1
commit
a88a31a1b2
|
@ -1,15 +1,15 @@
|
||||||
class ProfileContactsController
|
class ProfileContactsController
|
||||||
@.$inject = [
|
@.$inject = [
|
||||||
"tgResources",
|
"tgUserService",
|
||||||
"$tgAuth"
|
"$tgAuth"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@rs, @auth) ->
|
constructor: (@userService, @auth) ->
|
||||||
|
|
||||||
loadContacts: () ->
|
loadContacts: () ->
|
||||||
userId = @auth.getUser().id
|
userId = @auth.getUser().id
|
||||||
|
|
||||||
@rs.users.getContacts(userId)
|
@userService.getContacts(userId)
|
||||||
.then (contacts) =>
|
.then (contacts) =>
|
||||||
@.contacts = contacts
|
@.contacts = contacts
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,12 @@ describe "ProfileContacts", ->
|
||||||
$rootScope = null
|
$rootScope = null
|
||||||
mocks = {}
|
mocks = {}
|
||||||
|
|
||||||
_mockResources = () ->
|
_mockUserService = () ->
|
||||||
mocks.resources = {
|
mocks.userServices = {
|
||||||
users: {
|
|
||||||
getContacts: sinon.stub()
|
getContacts: sinon.stub()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
provide.value "tgResources", mocks.resources
|
provide.value "tgUserService", mocks.userServices
|
||||||
|
|
||||||
_mockAuthService = () ->
|
_mockAuthService = () ->
|
||||||
stub = sinon.stub()
|
stub = sinon.stub()
|
||||||
|
@ -26,7 +24,7 @@ describe "ProfileContacts", ->
|
||||||
_mocks = () ->
|
_mocks = () ->
|
||||||
module ($provide) ->
|
module ($provide) ->
|
||||||
provide = $provide
|
provide = $provide
|
||||||
_mockResources()
|
_mockUserService()
|
||||||
_mockAuthService()
|
_mockAuthService()
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
@ -50,7 +48,7 @@ describe "ProfileContacts", ->
|
||||||
{id: 3}
|
{id: 3}
|
||||||
]
|
]
|
||||||
|
|
||||||
mocks.resources.users.getContacts = (userId) ->
|
mocks.userServices.getContacts = (userId) ->
|
||||||
expect(userId).to.be.equal(userId)
|
expect(userId).to.be.equal(userId)
|
||||||
|
|
||||||
return $q (resolve, reject) ->
|
return $q (resolve, reject) ->
|
||||||
|
|
Loading…
Reference in New Issue