blob: 49d74e5b9e485cb07d348d115ed423704089abc8 (
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
28
29
30
31
32
33
34
35
36
|
import * as getters from '~/ref/stores/getters';
describe('Ref selector Vuex store getters', () => {
describe('isQueryPossiblyASha', () => {
it.each`
query | isPossiblyASha
${'abcd'} | ${true}
${'ABCD'} | ${true}
${'0123456789abcdef0123456789abcdef01234567'} | ${true}
${'0123456789abcdef0123456789abcdef012345678'} | ${false}
${'abc'} | ${false}
${'ghij'} | ${false}
${' abcd'} | ${false}
${''} | ${false}
${null} | ${false}
${undefined} | ${false}
`(
'returns true when the query potentially refers to a commit SHA',
({ query, isPossiblyASha }) => {
expect(getters.isQueryPossiblyASha({ query })).toBe(isPossiblyASha);
},
);
});
describe('isLoading', () => {
it.each`
requestCount | isLoading
${2} | ${true}
${1} | ${true}
${0} | ${false}
${-1} | ${false}
`('returns true when at least one request is in progress', ({ requestCount, isLoading }) => {
expect(getters.isLoading({ requestCount })).toBe(isLoading);
});
});
});
|