-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
frontend/packages/console-shared/src/utils/__tests__/pod-ring-utils.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as _ from 'lodash'; | ||
import { mockPod } from '../__mocks__/pod-utils-test-data'; | ||
import { podRingLabel } from '../pod-ring-utils'; | ||
import { ExtPodKind } from '../../types'; | ||
|
||
describe('pod-ring utils:', () => { | ||
it('should return proper title, subtitle, titleComponent, subtitleComponent for podRingLabel', () => { | ||
let mockData = _.set(_.cloneDeep(mockPod), 'spec.replicas', 2); | ||
mockData = _.set(mockData, 'status.avaiableReplicas', 1); | ||
expect(podRingLabel(mockData, true, [mockData as ExtPodKind])).toEqual({ | ||
title: '0', | ||
subtitle: 'scaling to 2', | ||
titleComponent: undefined, | ||
subtitleComponent: undefined, | ||
}); | ||
mockData = _.set(mockData, 'status.avaiableReplicas', 2); | ||
expect(podRingLabel(mockData, true, [mockData as ExtPodKind])).toEqual({ | ||
title: '2', | ||
subtitle: 'pods', | ||
titleComponent: undefined, | ||
subtitleComponent: undefined, | ||
}); | ||
}); | ||
|
||
it('should return title 0, subtitle scaing to 1 for podRingLabel when the first pod is being created', () => { | ||
let mockData = _.set(_.cloneDeep(mockPod), 'spec.replicas', 1); | ||
mockData = _.set(mockData, 'status.avaiableReplicas', 0); | ||
expect(podRingLabel(mockData, true, [mockData as ExtPodKind])).toEqual({ | ||
title: '0', | ||
subtitle: `scaling to 1`, | ||
titleComponent: undefined, | ||
subtitleComponent: undefined, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters