Skip to content

Commit 4db1854

Browse files
committed
fix(tests): address nits found by arkana
1 parent f52a8d9 commit 4db1854

5 files changed

Lines changed: 10 additions & 6 deletions

File tree

NArk.Tests.End2End/BatchSessionTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ await spendingService.Spend(walletDetails.walletIdentifier,
263263
$"Offchain tx with {numInputs} input VTXOs must produce exactly {numInputs} checkpoint transactions");
264264
}
265265

266+
// Decorator that records the checkpoint count passed to SubmitTx.
267+
// Must implement every IClientTransport method — if the interface gains a new member
268+
// this breaks at compile time, which is intentional (fail loudly, don't silently skip).
266269
private sealed class CheckpointSpyTransport(IClientTransport inner) : IClientTransport
267270
{
268271
public int LastSubmitCheckpointCount { get; private set; }
@@ -319,4 +322,4 @@ public Task<IReadOnlyList<string>> GetVirtualTxsAsync(IReadOnlyList<string> txid
319322
public Task<IReadOnlyList<VtxoTreeNode>> GetVtxoTreeAsync(OutPoint batchOutpoint, CancellationToken cancellationToken = default)
320323
=> inner.GetVtxoTreeAsync(batchOutpoint, cancellationToken);
321324
}
322-
}
325+
}

NArk.Tests.End2End/NoteTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,4 @@ await Task.WhenAll(
242242

243243
await Task.WhenAll(host1.StopAsync(), host2.StopAsync());
244244
}
245-
}
245+
}

NArk.Tests.End2End/OnchainTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,4 @@ await intentGenService.GenerateManualIntent(walletId,
199199
Assert.That(cancelled.CancellationReason, Is.Not.Null.And.Not.Empty,
200200
"Cancellation reason should contain arkd's rejection message");
201201
}
202-
}
202+
}

NArk.Tests.End2End/SubdustRejectionTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ await aliceSpending.Spend(alice.walletIdentifier,
7373
bobContractService, alice.clientTransport, new DefaultCoinSelector(),
7474
alice.safetyService, TestStorage.CreateIntentStorage());
7575

76-
// Assert.CatchAsync accepts any exception subtype (unlike Assert.ThrowsAsync which requires exact match)
7776
var ex = Assert.CatchAsync(
7877
() => bobSpending.Spend(bobWalletId,
7978
[new ArkTxOut(ArkTxOutType.Vtxo, Money.Satoshis(100), carolContract.GetArkAddress())]));
8079
Assert.That(ex, Is.Not.Null, "Spending a sub-dust VTXO must be rejected");
80+
Assert.That(ex!.Message, Does.Contain("dust").IgnoreCase,
81+
"Exception must originate from the dust threshold check, not an unrelated error");
8182
}
8283

8384
/// <summary>

NArk.Tests/BoltzSwapProvider404SafetyNetTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public async Task SuccessfulPollResetsCounter_SubsequentThresholdIsIndependent()
172172

173173
// Interleaved handler: first (Threshold-1) requests → 404, then one success, then 404s again
174174
var callCount = 0;
175-
var handler = new DelegatingHandler(req =>
175+
var handler = new FakeHandler(req =>
176176
{
177177
callCount++;
178178
if (callCount < Threshold || callCount == Threshold)
@@ -223,7 +223,7 @@ protected override Task<HttpResponseMessage> SendAsync(
223223
=> Task.FromResult(NotFoundResponse(swapId));
224224
}
225225

226-
private sealed class DelegatingHandler(
226+
private sealed class FakeHandler(
227227
Func<HttpRequestMessage, HttpResponseMessage> responder) : HttpMessageHandler
228228
{
229229
protected override Task<HttpResponseMessage> SendAsync(

0 commit comments

Comments
 (0)