Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Jun 18, 2024
1 parent a0735d5 commit acba5af
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ class VpnSettingsViewModelTest {
val expectedResistantState = QuantumResistantState.On
val mockSettings: Settings = mockk(relaxed = true)
val mockTunnelOptions: TunnelOptions = mockk(relaxed = true)
val mockWireguardTunnelOptions: WireguardTunnelOptions = mockk(relaxed = true)
// Can not use a mock here since mocking a value class val leads to class cast exception
val mockWireguardTunnelOptions =
WireguardTunnelOptions(mtu = Mtu(0), quantumResistant = expectedResistantState)

every { mockSettings.tunnelOptions } returns mockTunnelOptions
every { mockTunnelOptions.wireguard } returns mockWireguardTunnelOptions
every { mockWireguardTunnelOptions.quantumResistant } returns expectedResistantState
every { mockWireguardTunnelOptions.mtu } returns Mtu(0)
every { mockSettings.relaySettings } returns mockk<RelaySettings>(relaxed = true)

viewModel.uiState.test {
Expand Down

0 comments on commit acba5af

Please sign in to comment.