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