Commit f11e36d2 authored by Zack Cuddy's avatar Zack Cuddy Committed by Simon Knox

Geo Statuses - Fix empty section bug

There was an issue when there was
NOTHING to show that it would
omit the progress bars.

This was not the desired behavior,
we instead want to show the queued
jobs.
parent 1e32cb57
import { isNil } from 'lodash';
export default class GeoNodesStore {
constructor(primaryVersion, primaryRevision, replicableTypes) {
this.state = {};
......@@ -84,11 +86,17 @@ export default class GeoNodesStore {
};
});
// Adds replicable to array as long as value is defined
const verificationStatuses = syncStatuses.filter(s =>
Boolean(s.itemValue.verificationSuccessCount || s.itemValue.verificationFailureCount),
Boolean(
!isNil(s.itemValue.verificationSuccessCount) ||
!isNil(s.itemValue.verificationFailureCount),
),
);
// Adds replicable to array as long as value is defined
const checksumStatuses = syncStatuses.filter(s =>
Boolean(s.itemValue.checksumSuccessCount || s.itemValue.checksumFailureCount),
Boolean(!isNil(s.itemValue.checksumSuccessCount) || !isNil(s.itemValue.checksumFailureCount)),
);
return {
......
---
title: Geo Statuses - Fix empty section bug
merge_request: 40443
author:
type: fixed
......@@ -85,5 +85,47 @@ describe('GeoNodesStore', () => {
expect(syncStatusNames).toEqual(replicableTypesNames);
});
describe.each`
description | hasReplicable | mockVerificationDetails
${'null values'} | ${false} | ${{ test_type_count: null, test_type_verified_count: null, test_type_verification_failed_count: null }}
${'string values'} | ${true} | ${{ test_type_count: '10', test_type_verified_count: '5', test_type_verification_failed_count: '5' }}
${'number values'} | ${true} | ${{ test_type_count: 10, test_type_verified_count: 5, test_type_verification_failed_count: 5 }}
${'0 string values'} | ${true} | ${{ test_type_count: '0', test_type_verified_count: '0', test_type_verification_failed_count: '0' }}
${'0 number values'} | ${true} | ${{ test_type_count: 0, test_type_verified_count: 0, test_type_verification_failed_count: 0 }}
`(`verificationStatuses`, ({ description, hasReplicable, mockVerificationDetails }) => {
describe(`when node verification details contains ${description}`, () => {
it(`does ${hasReplicable ? '' : 'not'} contain replicable test_type`, () => {
const nodeDetails = GeoNodesStore.formatNodeDetails(mockVerificationDetails, [
{ namePlural: 'test_type' },
]);
expect(
nodeDetails.verificationStatuses.some(({ namePlural }) => namePlural === 'test_type'),
).toBe(hasReplicable);
});
});
});
describe.each`
description | hasReplicable | mockChecksumDetails
${'null values'} | ${false} | ${{ test_type_count: null, test_type_checksummed_count: null, test_type_checksum_failed_count: null }}
${'string values'} | ${true} | ${{ test_type_count: '10', test_type_checksummed_count: '5', test_type_checksum_failed_count: '5' }}
${'number values'} | ${true} | ${{ test_type_count: 10, test_type_checksummed_count: 5, test_type_checksum_failed_count: 5 }}
${'0 string values'} | ${true} | ${{ test_type_count: '0', test_type_checksummed_count: '0', test_type_checksum_failed_count: '0' }}
${'0 number values'} | ${true} | ${{ test_type_count: 0, test_type_checksummed_count: 0, test_type_checksum_failed_count: 0 }}
`(`checksumStatuses`, ({ description, hasReplicable, mockChecksumDetails }) => {
describe(`when node checksum details contains ${description}`, () => {
it(`does ${hasReplicable ? '' : 'not'} contain replicable test_type`, () => {
const nodeDetails = GeoNodesStore.formatNodeDetails(mockChecksumDetails, [
{ namePlural: 'test_type' },
]);
expect(
nodeDetails.checksumStatuses.some(({ namePlural }) => namePlural === 'test_type'),
).toBe(hasReplicable);
});
});
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment