summaryrefslogtreecommitdiff
path: root/spec/frontend/batch_comments/stores/modules/batch_comments/getters_spec.js
blob: 2398bb4feb157b26ae66c64723533e31c34af6c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as getters from '~/batch_comments/stores/modules/batch_comments/getters';

describe('Batch comments store getters', () => {
  describe('draftsForFile', () => {
    it('returns drafts for a file hash', () => {
      const state = {
        drafts: [
          {
            file_hash: 'filehash',
            comment: 'testing 123',
          },
          {
            file_hash: 'filehash2',
            comment: 'testing 1234',
          },
        ],
      };

      expect(getters.draftsForFile(state)('filehash')).toEqual([
        {
          file_hash: 'filehash',
          comment: 'testing 123',
        },
      ]);
    });
  });
});