@@ -97,6 +97,21 @@ describe('UserStore', function() {
97
97
assert . deepEqual ( store . committer , new Author ( FAKE_USER . email , FAKE_USER . name ) ) ;
98
98
} ) ;
99
99
100
+ it ( 'falls back to local git users and committers if loadMentionableUsers cannot load any user for whatever reason' , async function ( ) {
101
+ const workdirPath = await cloneRepository ( 'multiple-commits' ) ;
102
+ const repository = await buildRepository ( workdirPath ) ;
103
+
104
+ store = new UserStore ( { repository, config} ) ;
105
+ sinon . stub ( store , 'loadMentionableUsers' ) . returns ( undefined ) ;
106
+
107
+ await store . loadUsers ( ) ;
108
+ await nextUpdatePromise ( ) ;
109
+
110
+ assert . deepEqual ( store . getUsers ( ) , [
111
+ new Author ( '[email protected] ' , 'Katrina Uychaco' ) ,
112
+ ] ) ;
113
+ } ) ;
114
+
100
115
it ( 'loads store with mentionable users from the GitHub API in a repo with a GitHub remote' , async function ( ) {
101
116
await login . setToken ( 'https://api.github.com' , '1234' ) ;
102
117
@@ -223,12 +238,12 @@ describe('UserStore', function() {
223
238
const workdirPath = await cloneRepository ( 'multiple-commits' ) ;
224
239
const repository = await buildRepository ( workdirPath ) ;
225
240
store = new UserStore ( { repository, config} ) ;
241
+ sinon . spy ( store , 'addUsers' ) ;
226
242
await assert . async . lengthOf ( store . getUsers ( ) , 1 ) ;
243
+ await assert . async . equal ( store . addUsers . callCount , 1 ) ;
227
244
228
- sinon . spy ( store , 'addUsers' ) ;
229
245
// make a commit with FAKE_USER as committer
230
246
await repository . commit ( 'made a new commit' , { allowEmpty : true } ) ;
231
- await assert . async . equal ( store . addUsers . callCount , 1 ) ;
232
247
233
248
// verify that FAKE_USER is in commit history
234
249
const lastCommit = await repository . getLastCommit ( ) ;
0 commit comments