Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 40f2989

Browse files
author
vikasrohit
authored
Merge pull request #1190 from appirio-tech/feature/cognitive_comm_option_default_on
Github issue#95, Default cognitive to On in skill picker
2 parents 4f655ff + d5d6fa8 commit 40f2989

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

Diff for: app/skill-picker/skill-picker.controller.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ import _ from 'lodash'
8181
vm.communities['ibm_cognitive'] = {
8282
displayName: 'Cognitive',
8383
programId: vm.IBM_COGNITIVE_PROGRAM_ID,
84-
status: false,
85-
dirty: false,
84+
status: true,
85+
dirty: true,
8686
display: true
8787
}
8888
_addWatchToCommunity(vm.communities['ios'])

Diff for: app/skill-picker/skill-picker.spec.js

+24-10
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ describe('Skill Picker Controller', function() {
116116
expect(vm.username).to.exist.to.equal(mockProfile.handle)
117117
})
118118

119-
it('should not have page dirty ', function() {
119+
it('should have page dirty for default cognitive being on ', function() {
120120
var dirty = vm.isPageDirty()
121-
expect(dirty).to.equal(false)
121+
expect(dirty).to.equal(true)
122122
})
123123

124124
it('should be created successfully with showCommunity being true', function() {
@@ -159,6 +159,20 @@ describe('Skill Picker Controller', function() {
159159
$rootScope.$digest()
160160
expect(mockProfile.save).not.to.be.called
161161
expect(profileService.updateUserSkills).not.to.be.called
162+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
163+
// we should still go to dashboard if the function is called,
164+
// call to the function is controlled by disabling the button
165+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
166+
})
167+
168+
it('should not make any registerMember call with cognitive being turned off ', function() {
169+
vm.communities['ibm_cognitive'].status = false
170+
vm.communities['ibm_cognitive'].dirty = true
171+
vm.submitSkills()
172+
$rootScope.$digest()
173+
expect(mockProfile.save).not.to.be.called
174+
expect(profileService.updateUserSkills).not.to.be.called
175+
// we have turned off default on community, so no registerMember call expected
162176
expect(memberCertService.registerMember).not.to.be.called
163177
// we should still go to dashboard if the function is called,
164178
// call to the function is controlled by disabling the button
@@ -172,7 +186,7 @@ describe('Skill Picker Controller', function() {
172186
$rootScope.$digest()
173187
expect(mockProfile.save).to.be.calledOnce
174188
expect(profileService.updateUserSkills).not.to.be.called
175-
expect(memberCertService.registerMember).not.to.be.called
189+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
176190
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
177191
})
178192

@@ -190,7 +204,7 @@ describe('Skill Picker Controller', function() {
190204
expect(mockProfile.save).to.be.calledOnce
191205
expect(toasterSvc.pop).to.have.been.calledWith('error', 'Whoops!', sinon.match('wrong')).calledOnce
192206
expect(profileService.updateUserSkills).not.to.be.called
193-
expect(memberCertService.registerMember).not.to.be.called
207+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
194208
expect(state.go).not.to.be.called
195209
})
196210

@@ -200,7 +214,7 @@ describe('Skill Picker Controller', function() {
200214
$rootScope.$digest()
201215
expect(mockProfile.save).not.to.be.called
202216
expect(profileService.updateUserSkills).to.be.calledOnce
203-
expect(memberCertService.registerMember).not.to.be.called
217+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
204218
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
205219
})
206220

@@ -211,7 +225,7 @@ describe('Skill Picker Controller', function() {
211225
expect(mockProfile.save).not.to.be.called
212226
expect(profileService.updateUserSkills).to.be.calledOnce
213227
expect(toasterSvc.pop).to.have.been.calledWith('error', 'Whoops!', sinon.match('wrong')).calledOnce
214-
expect(memberCertService.registerMember).not.to.be.called
228+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
215229
expect(state.go).not.to.be.called
216230
})
217231

@@ -222,7 +236,7 @@ describe('Skill Picker Controller', function() {
222236
$rootScope.$digest()
223237
expect(mockProfile.save).not.to.be.called
224238
expect(profileService.updateUserSkills).not.to.be.called
225-
expect(memberCertService.registerMember).to.be.calledOnce
239+
expect(memberCertService.registerMember).to.be.calledTwice// once for cognitive (default on) and another for ios
226240
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
227241
})
228242

@@ -234,7 +248,7 @@ describe('Skill Picker Controller', function() {
234248
$rootScope.$digest()
235249
expect(mockProfile.save).not.to.be.called
236250
expect(profileService.updateUserSkills).not.to.be.called
237-
expect(memberCertService.registerMember).not.to.be.called
251+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
238252
// we should still go to dashboard if the function is called,
239253
// call to the function is controlled by disabling the button
240254
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
@@ -248,7 +262,7 @@ describe('Skill Picker Controller', function() {
248262
$rootScope.$digest()
249263
expect(mockProfile.save).not.to.be.called
250264
expect(profileService.updateUserSkills).not.to.be.called
251-
expect(memberCertService.registerMember).not.to.be.called
265+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
252266
// we should still go to dashboard if the function is called,
253267
// call to the function is controlled by disabling the button
254268
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
@@ -262,7 +276,7 @@ describe('Skill Picker Controller', function() {
262276
$rootScope.$digest()
263277
expect(mockProfile.save).not.to.be.called
264278
expect(profileService.updateUserSkills).not.to.be.called
265-
expect(memberCertService.registerMember).to.be.calledOnce
279+
expect(memberCertService.registerMember).to.be.calledTwice// once for cognitive (default on) and another for ios
266280
expect(toasterSvc.pop).to.have.been.calledWith('error', 'Whoops!', sinon.match('wrong')).calledOnce
267281
expect(state.go).not.to.be.called
268282
})

0 commit comments

Comments
 (0)