diff --git a/app/src/components/Flasher.js b/app/src/components/Flasher.js index a5009029..f23593a4 100644 --- a/app/src/components/Flasher.js +++ b/app/src/components/Flasher.js @@ -35,7 +35,7 @@ export function chipFamily(description) { // ESP image chip_id -> family name (matches esptool-js IMAGE_CHIP_ID values). const ESP_CHIP_ID_NAMES = { 0: 'ESP32', 2: 'ESP32-S2', 5: 'ESP32-C3', 9: 'ESP32-S3', - 12: 'ESP32-C2', 13: 'ESP32-C6', 16: 'ESP32-H2', 18: 'ESP32-C5', + 12: 'ESP32-C2', 13: 'ESP32-C6', 16: 'ESP32-H2', 17: 'ESP32-C5', 18: 'ESP32-P4', }; // Known ESP chip names, sorted so each maps to a stable color — colors survive reboots/refreshes and only shift diff --git a/app/src/components/Flasher.test.js b/app/src/components/Flasher.test.js index cdb468c8..2156a57d 100644 --- a/app/src/components/Flasher.test.js +++ b/app/src/components/Flasher.test.js @@ -27,14 +27,13 @@ jest.mock('esptool-js', () => ({ // Flasher fetches media firmware on mount; mock the API so tests don't hit the network. jest.mock('../api', () => ({ - filesSearch: jest.fn().mockResolvedValue([[], 0]), flasherSearch: jest.fn().mockResolvedValue([[], 0]), getFlasherConfigs: jest.fn().mockResolvedValue([]), saveFlasherConfig: jest.fn().mockResolvedValue(true), deleteFlasherConfig: jest.fn().mockResolvedValue(true), })); -import {filesSearch, flasherSearch, getFlasherConfigs} from '../api'; +import {flasherSearch, getFlasherConfigs} from '../api'; import { chipColor, chipTextColor, @@ -167,6 +166,9 @@ describe('chipIdName', () => { expect(chipIdName(0)).toBe('ESP32'); expect(chipIdName(2)).toBe('ESP32-S2'); expect(chipIdName(9)).toBe('ESP32-S3'); + // Must match the backend ESP_CHIP_IDS map: 17 -> C5, 18 -> P4 (not the reverse). + expect(chipIdName(17)).toBe('ESP32-C5'); + expect(chipIdName(18)).toBe('ESP32-P4'); }); it('falls back to a readable string for unknown ids', () => { @@ -245,8 +247,6 @@ describe('FlasherPage', () => { const original = Object.getOwnPropertyDescriptor(global.navigator, 'serial'); beforeEach(() => { - filesSearch.mockClear(); - filesSearch.mockResolvedValue([[], 0]); flasherSearch.mockClear(); flasherSearch.mockResolvedValue([[], 0]); getFlasherConfigs.mockClear();