Merge pull request #194 from davidmonterocrespo24/fix/pinmanager-test-mocks
fix(tests): update mocks + assertions for PinManager API changes
This commit is contained in:
commit
b4358786d6
|
|
@ -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();
|
||||
}),
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -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', () => {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}),
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue