From f02b6d3cf763ecfff971ca5965011256c945ba76 Mon Sep 17 00:00:00 2001 From: Plague Fox Date: Thu, 23 May 2024 11:16:07 +0400 Subject: [PATCH] Refactor SpinifyTransportFake to handle different RPC methods --- lib/src/transport_fake.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/transport_fake.dart b/lib/src/transport_fake.dart index e1340bc..953b011 100644 --- a/lib/src/transport_fake.dart +++ b/lib/src/transport_fake.dart @@ -150,12 +150,15 @@ class SpinifyTransportFake implements ISpinifyTransport { since: (epoch: '...', offset: Int64.ZERO), ), ); - case SpinifyRPCRequest(:int id, :List data): + case SpinifyRPCRequest(:int id, :String method, :List data): _response( (now) => SpinifyRPCResult( id: id, timestamp: now, - data: data, + data: switch (method) { + 'echo' => data, + _ => throw ArgumentError('Unknown method: $method'), + }, ), ); case SpinifyRefreshRequest(:int id):