Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/packages/list/utils_spec.js')
-rw-r--r--spec/frontend/packages/list/utils_spec.js48
1 files changed, 0 insertions, 48 deletions
diff --git a/spec/frontend/packages/list/utils_spec.js b/spec/frontend/packages/list/utils_spec.js
deleted file mode 100644
index 4e4f7b8a723..00000000000
--- a/spec/frontend/packages/list/utils_spec.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import { SORT_FIELDS } from '~/packages/list/constants';
-import { getNewPaginationPage, sortableFields } from '~/packages/list/utils';
-
-describe('Packages list utils', () => {
- describe('sortableFields', () => {
- it('returns the correct list when is a project page', () => {
- expect(sortableFields()).toEqual(SORT_FIELDS.filter((f) => f.orderBy !== 'project_path'));
- });
- it('returns the full list on the group page', () => {
- expect(sortableFields(true)).toEqual(SORT_FIELDS);
- });
- });
- describe('packageTypeDisplay', () => {
- it('returns the current page when total items exceeds pagniation', () => {
- expect(getNewPaginationPage(2, 20, 21)).toBe(2);
- });
-
- it('returns the previous page when total items is lower than or equal to pagination', () => {
- expect(getNewPaginationPage(2, 20, 20)).toBe(1);
- });
-
- it('returns the first page when totalItems is lower than or equal to perPage', () => {
- expect(getNewPaginationPage(4, 20, 20)).toBe(1);
- });
-
- describe('works when a different perPage is used', () => {
- it('returns the current page', () => {
- expect(getNewPaginationPage(2, 10, 11)).toBe(2);
- });
-
- it('returns the previous page', () => {
- expect(getNewPaginationPage(2, 10, 10)).toBe(1);
- });
- });
-
- describe.each`
- currentPage | totalItems | expectedResult
- ${1} | ${20} | ${1}
- ${2} | ${20} | ${1}
- ${3} | ${40} | ${2}
- ${4} | ${60} | ${3}
- `(`works across numerious pages`, ({ currentPage, totalItems, expectedResult }) => {
- it(`when currentPage is ${currentPage} return to the previous page ${expectedResult}`, () => {
- expect(getNewPaginationPage(currentPage, 20, totalItems)).toBe(expectedResult);
- });
- });
- });
-});