diff options
Diffstat (limited to 'spec/frontend/contributors/store/getters_spec.js')
-rw-r--r-- | spec/frontend/contributors/store/getters_spec.js | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/spec/frontend/contributors/store/getters_spec.js b/spec/frontend/contributors/store/getters_spec.js index 62ae9b36f87..e6342a669b7 100644 --- a/spec/frontend/contributors/store/getters_spec.js +++ b/spec/frontend/contributors/store/getters_spec.js @@ -29,33 +29,39 @@ describe('Contributors Store Getters', () => { beforeAll(() => { state.chartData = [ + { author_name: 'John Smith', author_email: 'jawnnypoo@gmail.com', date: '2019-05-05' }, { author_name: 'John', author_email: 'jawnnypoo@gmail.com', date: '2019-05-05' }, - { author_name: 'John', author_email: 'jawnnypoo@gmail.com', date: '2019-05-05' }, - { author_name: 'Carlson', author_email: 'jawnnypoo@gmail.com', date: '2019-03-03' }, - { author_name: 'Carlson', author_email: 'jawnnypoo@gmail.com', date: '2019-05-05' }, - { author_name: 'John', author_email: 'jawnnypoo@gmail.com', date: '2019-04-04' }, + { author_name: 'Carlson', author_email: 'carlson123@gitlab.com', date: '2019-03-03' }, + { author_name: 'Carlson', author_email: 'carlson123@gmail.com', date: '2019-05-05' }, { author_name: 'John', author_email: 'jawnnypoo@gmail.com', date: '2019-04-04' }, + { author_name: 'Johan', author_email: 'jawnnypoo@gmail.com', date: '2019-04-04' }, { author_name: 'John', author_email: 'jawnnypoo@gmail.com', date: '2019-03-03' }, ]; parsed = getters.parsedData(state); }); - it('should group contributions by date ', () => { + it('should group contributions by date', () => { expect(parsed.total).toMatchObject({ '2019-05-05': 3, '2019-03-03': 2, '2019-04-04': 2 }); }); - it('should group contributions by author ', () => { - expect(parsed.byAuthor).toMatchObject({ - Carlson: { - email: 'jawnnypoo@gmail.com', - commits: 2, + it('should group contributions by email and use most recent name', () => { + expect(parsed.byAuthorEmail).toMatchObject({ + 'carlson123@gmail.com': { + name: 'Carlson', + commits: 1, dates: { - '2019-03-03': 1, '2019-05-05': 1, }, }, - John: { - email: 'jawnnypoo@gmail.com', + 'carlson123@gitlab.com': { + name: 'Carlson', + commits: 1, + dates: { + '2019-03-03': 1, + }, + }, + 'jawnnypoo@gmail.com': { + name: 'John Smith', commits: 5, dates: { '2019-03-03': 1, |