blob: 8740691a8ee52046f5430bad35184597102467c3 (
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
37
38
39
40
|
import { packagePipeline } from '~/packages_and_registries/infrastructure_registry/details/store/getters';
import {
npmPackage,
mockPipelineInfo,
mavenPackage as packageWithoutBuildInfo,
} from 'jest/packages/mock_data';
describe('Getters PackageDetails Store', () => {
let state;
const defaultState = {
packageEntity: packageWithoutBuildInfo,
};
const setupState = (testState = {}) => {
state = {
...defaultState,
...testState,
};
};
describe('packagePipeline', () => {
it('should return the pipeline info when pipeline exists', () => {
setupState({
packageEntity: {
...npmPackage,
pipeline: mockPipelineInfo,
},
});
expect(packagePipeline(state)).toEqual(mockPipelineInfo);
});
it('should return null when build_info does not exist', () => {
setupState({ pipeline: undefined });
expect(packagePipeline(state)).toBe(null);
});
});
});
|