diff --git a/packages/agent_dart_base/test/agent/actor.dart b/packages/agent_dart_base/test/agent/actor.dart index cfe4b73f..c046205b 100644 --- a/packages/agent_dart_base/test/agent/actor.dart +++ b/packages/agent_dart_base/test/agent/actor.dart @@ -1,7 +1,38 @@ +import 'package:agent_dart_base/agent_dart_base.dart'; +import 'package:test/test.dart'; + void main() { actorTest(); } void actorTest() { - /// skip, see https://github.com/dfinity/agent-js/blob/main/packages/agent/src/actor.test.ts + test('actor', () async { + final agent = HttpAgent( + defaultHost: 'icp-api.io', + defaultPort: 443, + options: const HttpAgentOptions(identity: AnonymousIdentity()), + ); + final idl = IDL.Service({ + 'create_challenge': IDL.Func( + [], + [ + IDL.Record({ + 'png_base64': IDL.Text, + 'challenge_key': IDL.Text, + }), + ], + [], + ), + }); + final actor = CanisterActor( + ActorConfig( + canisterId: Principal.fromText('rdmx6-jaaaa-aaaaa-aaadq-cai'), + agent: agent, + ), + idl, + ); + final result = await actor.getFunc('create_challenge')!.call([]); + expect(result, isA()); + expect(result['challenge_key'], isA()); + }); } diff --git a/packages/agent_dart_base/test/agent/agent.dart b/packages/agent_dart_base/test/agent/agent.dart index 70a9bf4b..f46083b0 100644 --- a/packages/agent_dart_base/test/agent/agent.dart +++ b/packages/agent_dart_base/test/agent/agent.dart @@ -1,3 +1,5 @@ +import '../test_utils.dart'; +import 'actor.dart' as actor; import 'cbor.dart' as cbor; import 'certificate.dart' as certificate; import 'request_id.dart' as request_id; @@ -6,10 +8,12 @@ import 'utils/hash.dart' as hash; import 'utils/leb128.dart' as leb128; void main() { + ffiInit(); + actor.main(); + cbor.main(); certificate.main(); request_id.main(); bls.main(); hash.main(); leb128.main(); - cbor.main(); }