37 lines
806 B
JavaScript
37 lines
806 B
JavaScript
![]() |
import getList from '~/packages/list/stores/getters';
|
||
|
import { packageList } from '../../mock_data';
|
||
|
|
||
|
describe('Getters registry list store', () => {
|
||
|
let state;
|
||
|
|
||
|
const setState = ({ isGroupPage = false } = {}) => {
|
||
|
state = {
|
||
|
packages: packageList,
|
||
|
config: {
|
||
|
isGroupPage,
|
||
|
},
|
||
|
};
|
||
|
};
|
||
|
|
||
|
beforeEach(() => setState());
|
||
|
|
||
|
afterEach(() => {
|
||
|
state = null;
|
||
|
});
|
||
|
|
||
|
describe('getList', () => {
|
||
|
it('returns a list of packages', () => {
|
||
|
const result = getList(state);
|
||
|
|
||
|
expect(result).toHaveLength(packageList.length);
|
||
|
expect(result[0].name).toBe('Test package');
|
||
|
});
|
||
|
|
||
|
it('adds projectPathName', () => {
|
||
|
const result = getList(state);
|
||
|
|
||
|
expect(result[0].projectPathName).toMatchInlineSnapshot(`"foo / bar / baz"`);
|
||
|
});
|
||
|
});
|
||
|
});
|