cdd-cli 3.1.7 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -1
- package/.github/workflows/ci.yml +3 -0
- package/.github/workflows/docs.yml +8 -1
- package/CHANGELOG.md +40 -0
- package/CONTRIBUTING.md +28 -15
- package/README.md +56 -88
- package/babel.config.cjs +18 -1
- package/coverage/clover.xml +604 -0
- package/coverage/coverage-final.json +17 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helpers/constants.js.html +235 -0
- package/coverage/lcov-report/helpers/containerOptionsBuilder.js.html +211 -0
- package/coverage/lcov-report/helpers/dockerService/serviceComponents/containerActions.js.html +853 -0
- package/coverage/lcov-report/helpers/dockerService/serviceComponents/containerList.js.html +289 -0
- package/coverage/lcov-report/helpers/dockerService/serviceComponents/index.html +131 -0
- package/coverage/lcov-report/helpers/index.html +176 -0
- package/coverage/lcov-report/helpers/logger.js.html +424 -0
- package/coverage/lcov-report/helpers/safeCall.js.html +139 -0
- package/coverage/lcov-report/helpers/validationHelpers.js.html +394 -0
- package/coverage/lcov-report/hooks/creation/index.html +146 -0
- package/coverage/lcov-report/hooks/creation/useContainerActions.js.html +292 -0
- package/coverage/lcov-report/hooks/creation/useContainerCreation.js.html +478 -0
- package/coverage/lcov-report/hooks/creation/useLogsViewer.js.html +238 -0
- package/coverage/lcov-report/hooks/debug/index.html +116 -0
- package/coverage/lcov-report/hooks/debug/useDebugLogs.js.html +172 -0
- package/coverage/lcov-report/hooks/index.html +161 -0
- package/coverage/lcov-report/hooks/navigation/index.html +116 -0
- package/coverage/lcov-report/hooks/navigation/useContainerSelection.js.html +160 -0
- package/coverage/lcov-report/hooks/useContainerCommandRouter.js.html +415 -0
- package/coverage/lcov-report/hooks/useControls.js.html +685 -0
- package/coverage/lcov-report/hooks/useEraseConfirmation.js.html +202 -0
- package/coverage/lcov-report/hooks/useExitHandler.js.html +283 -0
- package/coverage/lcov-report/index.html +191 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +1216 -0
- package/dist/components/ContainerRow.js +5 -78
- package/dist/components/LogViewer.js +4 -9
- package/dist/helpers/containerOptionsBuilder.js +58 -0
- package/dist/hooks/creation/useContainerCreation.js +16 -1
- package/dist/hooks/debug/useDebugLogs.js +46 -0
- package/dist/hooks/navigation/useContainerSelection.js +36 -0
- package/dist/hooks/useContainerCommandRouter.js +151 -0
- package/dist/{helpers/actionHelpers.js → hooks/useContainerStats.js} +76 -78
- package/dist/hooks/useControls.js +83 -342
- package/dist/hooks/useEraseConfirmation.js +47 -0
- package/dist/hooks/useExitHandler.js +68 -0
- package/jest.config.cjs +1 -1
- package/package.json +2 -3
- package/src/components/ContainerRow.jsx +3 -38
- package/src/components/LogViewer.jsx +4 -10
- package/src/helpers/constants.js +20 -0
- package/src/helpers/containerOptionsBuilder.js +42 -0
- package/src/helpers/dockerService/serviceComponents/containerActions.js +55 -8
- package/src/helpers/validationHelpers.js +75 -18
- package/src/hooks/creation/useContainerCreation.js +34 -4
- package/src/hooks/debug/useDebugLogs.js +29 -0
- package/src/hooks/navigation/useContainerSelection.js +25 -0
- package/src/hooks/useContainerCommandRouter.js +110 -0
- package/src/hooks/useContainerStats.js +44 -0
- package/src/hooks/useControls.js +75 -274
- package/src/hooks/useEraseConfirmation.js +39 -0
- package/src/hooks/useExitHandler.js +66 -0
- package/test/containerActions.test.js +104 -13
- package/test/containerOptionsBuilder.test.js +36 -0
- package/test/useContainerCreation.dom.test.js +46 -2
- package/test/useControls.dom.test.js +117 -0
- package/test/validationHelpers.test.js +51 -0
- package/.babelrc +0 -6
- package/FIXES_APPLIED.md +0 -419
- package/SECURITY.md +0 -5
- package/dist/hooks/useLogsStream.js +0 -41
- package/docs/_config.yml +0 -13
- package/docs/components_ContainerCreationPrompt.jsx.html +0 -114
- package/docs/components_ContainerRow.jsx.html +0 -151
- package/docs/components_ContainerSection.jsx.html +0 -75
- package/docs/components_Footer.jsx.html +0 -66
- package/docs/components_Header.jsx.html +0 -84
- package/docs/components_LogViewer.jsx.html +0 -91
- package/docs/components_MessageFeedback.jsx.html +0 -76
- package/docs/components_PromptField.jsx.html +0 -99
- package/docs/components_StatsBar.jsx.html +0 -105
- package/docs/components_UsageMenu.jsx.html +0 -73
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/global.html +0 -6145
- package/docs/helpers_actionHelpers.js.html +0 -94
- package/docs/helpers_constants.js.html +0 -81
- package/docs/helpers_dockerService_dockerService.js.html +0 -79
- package/docs/helpers_dockerService_serviceComponents_containerActions.js.html +0 -153
- package/docs/helpers_dockerService_serviceComponents_containerList.js.html +0 -81
- package/docs/helpers_dockerService_serviceComponents_containerLogs.js.html +0 -85
- package/docs/helpers_dockerService_serviceComponents_containerStats.js.html +0 -107
- package/docs/helpers_dockerService_serviceComponents_imageUtils.js.html +0 -82
- package/docs/helpers_exitWithMessage.js.html +0 -77
- package/docs/helpers_safeCall.js.html +0 -68
- package/docs/helpers_validationHelpers.js.html +0 -96
- package/docs/hooks_creation_useContainerActions.js.html +0 -120
- package/docs/hooks_creation_useContainerCreation.js.html +0 -152
- package/docs/hooks_creation_useLogsViewer.js.html +0 -102
- package/docs/hooks_useControls.js.html +0 -298
- package/docs/hooks_useLogsStream.js.html +0 -82
- package/docs/index.html +0 -65
- package/docs/index.js.html +0 -65
- package/docs/module-index.html +0 -171
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/styles/jsdoc-default.css +0 -358
- package/docs/styles/prettify-jsdoc.css +0 -111
- package/docs/styles/prettify-tomorrow.css +0 -132
- package/esbuild.config.cjs +0 -11
- package/src/helpers/actionHelpers.js +0 -52
- package/src/hooks/useLogsStream.js +0 -31
- package/test/actionHelpers.test.js +0 -106
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { jest } from '@jest/globals';
|
|
2
|
-
import { handleAction } from '../src/helpers/actionHelpers.js';
|
|
3
|
-
import { MESSAGE_TIMEOUTS } from '../src/helpers/constants.js';
|
|
4
|
-
|
|
5
|
-
describe('handleAction', () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
jest.useFakeTimers();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
afterEach(() => {
|
|
11
|
-
jest.useRealTimers();
|
|
12
|
-
jest.clearAllMocks();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test('returns early when no container selected', async () => {
|
|
16
|
-
const setMessage = jest.fn();
|
|
17
|
-
const setMessageColor = jest.fn();
|
|
18
|
-
const actionFn = jest.fn();
|
|
19
|
-
|
|
20
|
-
await handleAction({
|
|
21
|
-
containers: [],
|
|
22
|
-
selected: 0,
|
|
23
|
-
actionFn,
|
|
24
|
-
actionLabel: 'Start',
|
|
25
|
-
setMessage,
|
|
26
|
-
setMessageColor,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
expect(actionFn).not.toHaveBeenCalled();
|
|
30
|
-
expect(setMessage).not.toHaveBeenCalled();
|
|
31
|
-
expect(setMessageColor).not.toHaveBeenCalled();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('uses stateCheck and shows error then clears message after SHORT timeout', async () => {
|
|
35
|
-
const setMessage = jest.fn();
|
|
36
|
-
const setMessageColor = jest.fn();
|
|
37
|
-
const actionFn = jest.fn();
|
|
38
|
-
|
|
39
|
-
const containers = [{ id: 'c1', name: 'one' }];
|
|
40
|
-
|
|
41
|
-
const stateCheck = (_c) => 'Already running';
|
|
42
|
-
|
|
43
|
-
await handleAction({
|
|
44
|
-
containers,
|
|
45
|
-
selected: 0,
|
|
46
|
-
actionFn,
|
|
47
|
-
actionLabel: 'Start',
|
|
48
|
-
setMessage,
|
|
49
|
-
setMessageColor,
|
|
50
|
-
stateCheck,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
expect(setMessage).toHaveBeenCalledWith('Already running');
|
|
54
|
-
expect(setMessageColor).toHaveBeenCalledWith('red');
|
|
55
|
-
expect(actionFn).not.toHaveBeenCalled();
|
|
56
|
-
|
|
57
|
-
// advance timers to allow message clear
|
|
58
|
-
jest.advanceTimersByTime(MESSAGE_TIMEOUTS.SHORT + 10);
|
|
59
|
-
expect(setMessage).toHaveBeenCalledWith('');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('on success sets success message and clears after DEFAULT timeout', async () => {
|
|
63
|
-
const setMessage = jest.fn();
|
|
64
|
-
const setMessageColor = jest.fn();
|
|
65
|
-
const actionFn = jest.fn().mockResolvedValue(undefined);
|
|
66
|
-
|
|
67
|
-
const containers = [{ id: 'c1', name: 'one' }];
|
|
68
|
-
|
|
69
|
-
await handleAction({
|
|
70
|
-
containers,
|
|
71
|
-
selected: 0,
|
|
72
|
-
actionFn,
|
|
73
|
-
actionLabel: 'Start',
|
|
74
|
-
setMessage,
|
|
75
|
-
setMessageColor,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
expect(actionFn).toHaveBeenCalledWith('c1');
|
|
79
|
-
expect(setMessage).toHaveBeenCalledWith('Start container completed successfully');
|
|
80
|
-
expect(setMessageColor).toHaveBeenCalledWith('green');
|
|
81
|
-
|
|
82
|
-
jest.advanceTimersByTime(MESSAGE_TIMEOUTS.DEFAULT + 10);
|
|
83
|
-
expect(setMessage).toHaveBeenCalledWith('');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('on failure sets failed message and color red', async () => {
|
|
87
|
-
const setMessage = jest.fn();
|
|
88
|
-
const setMessageColor = jest.fn();
|
|
89
|
-
const actionFn = jest.fn().mockRejectedValue(new Error('boom'));
|
|
90
|
-
|
|
91
|
-
const containers = [{ id: 'c1', name: 'one' }];
|
|
92
|
-
|
|
93
|
-
await handleAction({
|
|
94
|
-
containers,
|
|
95
|
-
selected: 0,
|
|
96
|
-
actionFn,
|
|
97
|
-
actionLabel: 'Stop',
|
|
98
|
-
setMessage,
|
|
99
|
-
setMessageColor,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
expect(actionFn).toHaveBeenCalledWith('c1');
|
|
103
|
-
expect(setMessage).toHaveBeenCalledWith('Failed to stop container.');
|
|
104
|
-
expect(setMessageColor).toHaveBeenCalledWith('red');
|
|
105
|
-
});
|
|
106
|
-
});
|