Merge pull request #194 from davidmonterocrespo24/fix/pinmanager-test-mocks

fix(tests): update mocks + assertions for PinManager API changes
This commit is contained in:
David Montero Crespo 2026-05-19 00:16:21 -03:00 committed by GitHub
commit b4358786d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 4 deletions

View File

@ -46,6 +46,7 @@ vi.mock('../simulation/PinManager', () => ({
this.updatePort = vi.fn();
this.onPinChange = vi.fn().mockReturnValue(() => {});
this.getListenersCount = vi.fn().mockReturnValue(0);
this.resetPinStates = vi.fn();
}),
}));

View File

@ -158,9 +158,11 @@ describe('ESP32-C3 bare-metal blink (compiled with riscv32-esp-elf-gcc)', () =>
sim.loadBin(binData);
runSteps(sim, 2000);
// PinManager must have received GPIO 8 state changes
expect(pm.setPinState).toHaveBeenCalledWith(8, true);
expect(pm.setPinState).toHaveBeenCalledWith(8, false);
// PinManager must have received GPIO 8 state changes. Production code
// passes the optional `source` argument ('mcu') since PinManager added
// the input/output classification field.
expect(pm.setPinState).toHaveBeenCalledWith(8, true, 'mcu');
expect(pm.setPinState).toHaveBeenCalledWith(8, false, 'mcu');
});
it('timestamps increase monotonically across blink events', () => {

View File

@ -480,7 +480,7 @@ describe('Esp32C3Simulator — GPIO pin toggling', () => {
core.reset(0x42000000);
runSteps(core, 3);
expect(pm.setPinState).toHaveBeenCalledWith(0, true);
expect(pm.setPinState).toHaveBeenCalledWith(0, true, 'mcu');
s.stop();
});
});

View File

@ -48,6 +48,7 @@ vi.mock('../simulation/PinManager', () => ({
this.updatePort = vi.fn();
this.onPinChange = vi.fn().mockReturnValue(() => {});
this.getListenersCount = vi.fn().mockReturnValue(0);
this.resetPinStates = vi.fn();
}),
}));