From db4c80f853918bdf77118ecccff88c8339b1a311 Mon Sep 17 00:00:00 2001 From: Kawa Date: Fri, 27 Mar 2026 11:40:21 +0100 Subject: [PATCH] test(04-01): add RED stubs for all Phase 4 requirements in ReviewStep.test.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CONF-02: live rclone.conf preview - CONF-03: copy rclone.conf to clipboard - DOWN-01 through DOWN-06: individual and ZIP download buttons - SECU-01: download gating behind security checkbox - SECU-02: privacy/no-server message - Mocks: downloadFile, downloadZip, navigator.clipboard, URL - All stubs use expect.fail('not yet implemented') — named RED baseline --- src/components/wizard/ReviewStep.test.tsx | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 src/components/wizard/ReviewStep.test.tsx diff --git a/src/components/wizard/ReviewStep.test.tsx b/src/components/wizard/ReviewStep.test.tsx new file mode 100644 index 0000000..e4b7ec2 --- /dev/null +++ b/src/components/wizard/ReviewStep.test.tsx @@ -0,0 +1,95 @@ +// @vitest-environment jsdom +// Covers CONF-02, CONF-03: rclone.conf preview and clipboard copy +// Covers DOWN-01 through DOWN-06: individual and ZIP download buttons +// Covers SECU-01: download gating behind security checkbox +// Covers SECU-02: privacy/no-server message in rendered output +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, fireEvent } from '@testing-library/react'; +import React from 'react'; +import ReviewStep from './ReviewStep'; +import { WizardProvider } from '../../store/context'; + +vi.mock('../../utils/downloadFile', () => ({ downloadFile: vi.fn() })); +vi.mock('../../utils/downloadZip', () => ({ downloadZip: vi.fn() })); + +beforeEach(() => { + vi.stubGlobal('navigator', { + clipboard: { writeText: vi.fn().mockResolvedValue(undefined) }, + }); + vi.stubGlobal('URL', { + createObjectURL: vi.fn(() => 'blob:mock'), + revokeObjectURL: vi.fn(), + }); + vi.clearAllMocks(); +}); + +// Helper: render ReviewStep inside WizardProvider. +// The fully populated state must be injected by the implementation via +// a custom context initializer — for now the wrapper just provides the provider. +function renderStep() { + return render( + + + + ); +} + +describe('CONF-02: live rclone.conf preview', () => { + it('shows rclone.conf preview text when backendType is set', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('CONF-03: copy rclone.conf to clipboard', () => { + it('clicking Copy on rclone.conf block calls clipboard.writeText with conf content', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('DOWN-01: download rclone.conf', () => { + it('clicking Download rclone.conf calls downloadFile with content and filename rclone.conf', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('DOWN-02: download Intune install script', () => { + it('clicking Download Intune Install calls downloadFile with content and filename intune-install.ps1', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('DOWN-03: download Intune detection script', () => { + it('clicking Download Intune Detection calls downloadFile with content and filename intune-detection.ps1', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('DOWN-04: download RMM script', () => { + it('clicking Download RMM script calls downloadFile with content and filename rmm-script.ps1', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('DOWN-05: download ZIP with all files', () => { + it('clicking Download ZIP calls downloadZip with all 4 file entries', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('DOWN-06: copy button per output block', () => { + it('each output block has a copy button that calls clipboard.writeText with that block content', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('SECU-01: download buttons disabled until security checkbox checked', () => { + it('download buttons are disabled when security checkbox is unchecked; enabled after checking', () => { + expect.fail('not yet implemented'); + }); +}); + +describe('SECU-02: no-server privacy message', () => { + it('rendered output contains text about no data being sent to a server', () => { + expect.fail('not yet implemented'); + }); +});