2019-12-10 10:07:52 -05:00
|
|
|
import { mount } from '@vue/test-utils';
|
2022-01-25 07:14:14 -05:00
|
|
|
import { nextTick } from 'vue';
|
2021-02-14 13:09:20 -05:00
|
|
|
import CanaryUpdateModal from '~/environments/components/canary_update_modal.vue';
|
|
|
|
import DeployBoard from '~/environments/components/deploy_board.vue';
|
2019-12-10 10:07:52 -05:00
|
|
|
import EnvironmentTable from '~/environments/components/environments_table.vue';
|
2021-01-05 13:10:25 -05:00
|
|
|
import eventHub from '~/environments/event_hub';
|
|
|
|
import { folder, deployBoardMockData } from './mock_data';
|
2019-12-10 10:07:52 -05:00
|
|
|
|
|
|
|
const eeOnlyProps = {
|
|
|
|
userCalloutsPath: '/callouts',
|
|
|
|
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
|
|
|
|
helpCanaryDeploymentsPath: 'help/canary-deployments',
|
|
|
|
};
|
2017-11-23 07:04:03 -05:00
|
|
|
|
|
|
|
describe('Environment table', () => {
|
2019-12-10 10:07:52 -05:00
|
|
|
let wrapper;
|
2017-02-13 11:11:11 -05:00
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
const factory = (options = {}) => {
|
|
|
|
// This destroys any wrappers created before a nested call to factory reassigns it
|
|
|
|
if (wrapper && wrapper.destroy) {
|
|
|
|
wrapper.destroy();
|
|
|
|
}
|
|
|
|
wrapper = mount(EnvironmentTable, {
|
|
|
|
...options,
|
|
|
|
});
|
2019-03-08 05:01:46 -05:00
|
|
|
};
|
|
|
|
|
2017-02-13 11:11:11 -05:00
|
|
|
beforeEach(() => {
|
2019-12-10 10:07:52 -05:00
|
|
|
factory({
|
|
|
|
propsData: {
|
|
|
|
environments: [folder],
|
|
|
|
...eeOnlyProps,
|
|
|
|
},
|
|
|
|
});
|
2017-11-23 07:04:03 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
2019-12-10 10:07:52 -05:00
|
|
|
wrapper.destroy();
|
2017-02-13 11:11:11 -05:00
|
|
|
});
|
|
|
|
|
2021-01-05 13:10:25 -05:00
|
|
|
it('Should render a table', async () => {
|
|
|
|
const mockItem = {
|
|
|
|
name: 'review',
|
|
|
|
folderName: 'review',
|
|
|
|
size: 3,
|
|
|
|
isFolder: true,
|
|
|
|
environment_path: 'url',
|
|
|
|
};
|
|
|
|
|
|
|
|
await factory({
|
|
|
|
propsData: {
|
|
|
|
environments: [mockItem],
|
|
|
|
userCalloutsPath: '/callouts',
|
|
|
|
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
|
|
|
|
helpCanaryDeploymentsPath: 'help/canary-deployments',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
expect(wrapper.classes()).toContain('ci-table');
|
2017-02-13 11:11:11 -05:00
|
|
|
});
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
|
2021-01-05 13:10:25 -05:00
|
|
|
it('should render deploy board container when data is provided', async () => {
|
|
|
|
const mockItem = {
|
|
|
|
name: 'review',
|
|
|
|
size: 1,
|
|
|
|
environment_path: 'url',
|
|
|
|
logs_path: 'url',
|
|
|
|
id: 1,
|
|
|
|
hasDeployBoard: true,
|
|
|
|
deployBoardData: deployBoardMockData,
|
|
|
|
isDeployBoardVisible: true,
|
|
|
|
isLoadingDeployBoard: false,
|
|
|
|
isEmptyDeployBoard: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
await factory({
|
|
|
|
propsData: {
|
|
|
|
environments: [mockItem],
|
|
|
|
canCreateDeployment: false,
|
|
|
|
userCalloutsPath: '/callouts',
|
|
|
|
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
|
|
|
|
helpCanaryDeploymentsPath: 'help/canary-deployments',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper.find('.js-deploy-board-row').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.deploy-board-icon').exists()).toBe(true);
|
|
|
|
});
|
|
|
|
|
2021-04-30 17:10:23 -04:00
|
|
|
it('should render deploy board container when data is provided for children', async () => {
|
|
|
|
const mockItem = {
|
|
|
|
name: 'review',
|
|
|
|
size: 1,
|
|
|
|
environment_path: 'url',
|
|
|
|
logs_path: 'url',
|
|
|
|
id: 1,
|
|
|
|
isFolder: true,
|
|
|
|
isOpen: true,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
name: 'review/test',
|
|
|
|
hasDeployBoard: true,
|
|
|
|
deployBoardData: deployBoardMockData,
|
|
|
|
isDeployBoardVisible: true,
|
|
|
|
isLoadingDeployBoard: false,
|
|
|
|
isEmptyDeployBoard: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
await factory({
|
|
|
|
propsData: {
|
|
|
|
environments: [mockItem],
|
|
|
|
canCreateDeployment: false,
|
|
|
|
userCalloutsPath: '/callouts',
|
|
|
|
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
|
|
|
|
helpCanaryDeploymentsPath: 'help/canary-deployments',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper.find('.js-deploy-board-row').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.deploy-board-icon').exists()).toBe(true);
|
|
|
|
});
|
|
|
|
|
2022-04-19 05:08:55 -04:00
|
|
|
it('should toggle deploy board visibility when arrow is clicked', async () => {
|
2021-01-05 13:10:25 -05:00
|
|
|
const mockItem = {
|
|
|
|
name: 'review',
|
|
|
|
size: 1,
|
|
|
|
environment_path: 'url',
|
|
|
|
id: 1,
|
|
|
|
hasDeployBoard: true,
|
|
|
|
deployBoardData: {
|
|
|
|
instances: [{ status: 'ready', tooltip: 'foo' }],
|
|
|
|
abort_url: 'url',
|
|
|
|
rollback_url: 'url',
|
|
|
|
completion: 100,
|
|
|
|
is_completed: true,
|
|
|
|
canary_ingress: { canary_weight: 60 },
|
|
|
|
},
|
|
|
|
isDeployBoardVisible: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
eventHub.$on('toggleDeployBoard', (env) => {
|
|
|
|
expect(env.id).toEqual(mockItem.id);
|
|
|
|
});
|
|
|
|
|
|
|
|
factory({
|
|
|
|
propsData: {
|
|
|
|
environments: [mockItem],
|
|
|
|
userCalloutsPath: '/callouts',
|
|
|
|
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
|
|
|
|
helpCanaryDeploymentsPath: 'help/canary-deployments',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-04-19 05:08:55 -04:00
|
|
|
await wrapper.find('.deploy-board-icon').trigger('click');
|
2021-01-05 13:10:25 -05:00
|
|
|
});
|
|
|
|
|
2021-04-30 17:10:23 -04:00
|
|
|
it('should set the environment to change and weight when a change canary weight event is recevied', async () => {
|
2021-01-05 13:10:25 -05:00
|
|
|
const mockItem = {
|
|
|
|
name: 'review',
|
|
|
|
size: 1,
|
|
|
|
environment_path: 'url',
|
|
|
|
logs_path: 'url',
|
|
|
|
id: 1,
|
|
|
|
hasDeployBoard: true,
|
|
|
|
deployBoardData: deployBoardMockData,
|
|
|
|
isDeployBoardVisible: true,
|
|
|
|
isLoadingDeployBoard: false,
|
|
|
|
isEmptyDeployBoard: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
await factory({
|
|
|
|
propsData: {
|
|
|
|
environments: [mockItem],
|
|
|
|
canCreateDeployment: false,
|
|
|
|
userCalloutsPath: '/callouts',
|
|
|
|
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
|
|
|
|
helpCanaryDeploymentsPath: 'help/canary-deployments',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
wrapper.find(DeployBoard).vm.$emit('changeCanaryWeight', 40);
|
2022-01-25 07:14:14 -05:00
|
|
|
await nextTick();
|
2021-01-05 13:10:25 -05:00
|
|
|
|
|
|
|
expect(wrapper.find(CanaryUpdateModal).props()).toMatchObject({
|
|
|
|
weight: 40,
|
|
|
|
environment: mockItem,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
describe('sortEnvironments', () => {
|
|
|
|
it('should sort environments by last updated', () => {
|
|
|
|
const mockItems = [
|
|
|
|
{
|
|
|
|
name: 'old',
|
|
|
|
size: 3,
|
|
|
|
isFolder: false,
|
|
|
|
last_deployment: {
|
|
|
|
created_at: new Date(2019, 0, 5).toISOString(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'new',
|
|
|
|
size: 3,
|
|
|
|
isFolder: false,
|
|
|
|
last_deployment: {
|
|
|
|
created_at: new Date(2019, 1, 5).toISOString(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'older',
|
|
|
|
size: 3,
|
|
|
|
isFolder: false,
|
|
|
|
last_deployment: {
|
|
|
|
created_at: new Date(2018, 0, 5).toISOString(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'an environment with no deployment',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
factory({
|
|
|
|
propsData: {
|
|
|
|
environments: mockItems,
|
|
|
|
...eeOnlyProps,
|
|
|
|
},
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
const [old, newer, older, noDeploy] = mockItems;
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
expect(wrapper.vm.sortEnvironments(mockItems)).toEqual([newer, old, older, noDeploy]);
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should push environments with no deployments to the bottom', () => {
|
|
|
|
const mockItems = [
|
|
|
|
{
|
|
|
|
name: 'production',
|
|
|
|
size: 1,
|
|
|
|
id: 2,
|
|
|
|
state: 'available',
|
|
|
|
external_url: 'https://google.com/production',
|
|
|
|
environment_type: null,
|
|
|
|
last_deployment: null,
|
|
|
|
has_stop_action: false,
|
|
|
|
environment_path: '/Commit451/lab-coat/environments/2',
|
|
|
|
stop_path: '/Commit451/lab-coat/environments/2/stop',
|
|
|
|
folder_path: '/Commit451/lab-coat/environments/folders/production',
|
|
|
|
created_at: '2019-01-17T16:26:10.064Z',
|
|
|
|
updated_at: '2019-01-17T16:27:37.717Z',
|
|
|
|
can_stop: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'review/225addcibuildstatus',
|
|
|
|
size: 2,
|
|
|
|
isFolder: true,
|
|
|
|
isLoadingFolderContent: false,
|
|
|
|
folderName: 'review',
|
|
|
|
isOpen: false,
|
|
|
|
children: [],
|
|
|
|
id: 12,
|
|
|
|
state: 'available',
|
|
|
|
external_url: 'https://google.com/review/225addcibuildstatus',
|
|
|
|
environment_type: 'review',
|
|
|
|
last_deployment: null,
|
|
|
|
has_stop_action: false,
|
|
|
|
environment_path: '/Commit451/lab-coat/environments/12',
|
|
|
|
stop_path: '/Commit451/lab-coat/environments/12/stop',
|
|
|
|
folder_path: '/Commit451/lab-coat/environments/folders/review',
|
|
|
|
created_at: '2019-01-17T16:27:37.877Z',
|
|
|
|
updated_at: '2019-01-17T16:27:37.883Z',
|
|
|
|
can_stop: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'staging',
|
|
|
|
size: 1,
|
|
|
|
id: 1,
|
|
|
|
state: 'available',
|
|
|
|
external_url: 'https://google.com/staging',
|
|
|
|
environment_type: null,
|
|
|
|
last_deployment: {
|
|
|
|
created_at: '2019-01-17T16:26:15.125Z',
|
|
|
|
scheduled_actions: [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
factory({
|
|
|
|
propsData: {
|
|
|
|
environments: mockItems,
|
|
|
|
...eeOnlyProps,
|
|
|
|
},
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
const [prod, review, staging] = mockItems;
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
expect(wrapper.vm.sortEnvironments(mockItems)).toEqual([review, staging, prod]);
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should sort environments by folder first', () => {
|
|
|
|
const mockItems = [
|
|
|
|
{
|
|
|
|
name: 'old',
|
|
|
|
size: 3,
|
|
|
|
isFolder: false,
|
|
|
|
last_deployment: {
|
|
|
|
created_at: new Date(2019, 0, 5).toISOString(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'new',
|
|
|
|
size: 3,
|
|
|
|
isFolder: false,
|
|
|
|
last_deployment: {
|
|
|
|
created_at: new Date(2019, 1, 5).toISOString(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'older',
|
|
|
|
size: 3,
|
|
|
|
isFolder: true,
|
|
|
|
children: [],
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
factory({
|
|
|
|
propsData: {
|
|
|
|
environments: mockItems,
|
|
|
|
...eeOnlyProps,
|
|
|
|
},
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
const [old, newer, older] = mockItems;
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
expect(wrapper.vm.sortEnvironments(mockItems)).toEqual([older, newer, old]);
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should break ties by name', () => {
|
|
|
|
const mockItems = [
|
|
|
|
{
|
|
|
|
name: 'old',
|
|
|
|
isFolder: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'new',
|
|
|
|
isFolder: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
folderName: 'older',
|
|
|
|
isFolder: true,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
factory({
|
|
|
|
propsData: {
|
|
|
|
environments: mockItems,
|
|
|
|
...eeOnlyProps,
|
|
|
|
},
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
const [old, newer, older] = mockItems;
|
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
expect(wrapper.vm.sortEnvironments(mockItems)).toEqual([older, newer, old]);
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('sortedEnvironments', () => {
|
|
|
|
it('it should sort children as well', () => {
|
|
|
|
const mockItems = [
|
|
|
|
{
|
|
|
|
name: 'production',
|
|
|
|
last_deployment: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'review/225addcibuildstatus',
|
|
|
|
isFolder: true,
|
|
|
|
folderName: 'review',
|
|
|
|
isOpen: true,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
name: 'review/225addcibuildstatus',
|
|
|
|
last_deployment: {
|
|
|
|
created_at: '2019-01-17T16:26:15.125Z',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-04-22 08:09:49 -04:00
|
|
|
name: 'review/main',
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
last_deployment: {
|
|
|
|
created_at: '2019-02-17T16:26:15.125Z',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'staging',
|
|
|
|
last_deployment: {
|
|
|
|
created_at: '2019-01-17T16:26:15.125Z',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
const [production, review, staging] = mockItems;
|
2021-04-22 08:09:49 -04:00
|
|
|
const [addcibuildstatus, main] = mockItems[1].children;
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
|
2019-12-10 10:07:52 -05:00
|
|
|
factory({
|
|
|
|
propsData: {
|
|
|
|
environments: mockItems,
|
|
|
|
...eeOnlyProps,
|
|
|
|
},
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
expect(wrapper.vm.sortedEnvironments.map((env) => env.name)).toEqual([
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
review.name,
|
|
|
|
staging.name,
|
|
|
|
production.name,
|
|
|
|
]);
|
|
|
|
|
2021-04-22 08:09:49 -04:00
|
|
|
expect(wrapper.vm.sortedEnvironments[0].children).toEqual([main, addcibuildstatus]);
|
Sort Environments in Table by Last Updated
Ensure folders push to the top, if both have no last update, sort by
name.
The sorting algorithm should sort in the following priorities:
1. folders first,
2. last updated descending,
3. by name ascending,
the sorting algorithm must:
1. Sort by name ascending,
2. Reverse (sort by name descending),
3. Sort by last deployment ascending,
4. Reverse (last deployment descending, name ascending),
5. Put folders first.
It is done this way, as `underscore`'s sort API is very basic: simple
comparisons, sorting by ascending only.
2019-02-11 10:25:10 -05:00
|
|
|
});
|
|
|
|
});
|
2017-02-13 11:11:11 -05:00
|
|
|
});
|