add to killswitch disabled test

This commit is contained in:
sneurlax 2023-09-08 14:50:43 -05:00
parent dea3be904e
commit 4aba0b50fb

View file

@ -1561,6 +1561,7 @@ void main() {
verifyNoMoreInteractions(mockPrefs); verifyNoMoreInteractions(mockPrefs);
}); });
// useTor is true but Tor is not enabled, but because the killswitch is off, TorService calls should be made.
test("killswitch disabled", () async { test("killswitch disabled", () async {
final mockClient = MockJsonRPC(); final mockClient = MockJsonRPC();
const command = "blockchain.transaction.get"; const command = "blockchain.transaction.get";
@ -1583,8 +1584,8 @@ void main() {
when(mockPrefs.useTor).thenAnswer((_) => true); when(mockPrefs.useTor).thenAnswer((_) => true);
when(mockPrefs.torKillswitch).thenAnswer((_) => false); when(mockPrefs.torKillswitch).thenAnswer((_) => false);
when(mockPrefs.wifiOnly).thenAnswer((_) => false); when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final torService = MockTorService(); final mockTorService = MockTorService();
when(torService.enabled).thenAnswer((_) => false); when(mockTorService.enabled).thenAnswer((_) => false);
final client = ElectrumX( final client = ElectrumX(
host: "some server", host: "some server",
@ -1593,7 +1594,7 @@ void main() {
client: mockClient, client: mockClient,
failovers: [], failovers: [],
prefs: mockPrefs, prefs: mockPrefs,
torService: torService, torService: mockTorService,
); );
final result = await client.getTransaction( final result = await client.getTransaction(
@ -1607,6 +1608,8 @@ void main() {
verify(mockPrefs.useTor).called(1); verify(mockPrefs.useTor).called(1);
verify(mockPrefs.torKillswitch).called(1); verify(mockPrefs.torKillswitch).called(1);
verifyNoMoreInteractions(mockPrefs); verifyNoMoreInteractions(mockPrefs);
verify(mockTorService.enabled).called(1);
verifyNoMoreInteractions(mockTorService);
}); });
}); });
} }