Priyaranjan Mudliar
05/17/2023, 9:52 AM%% pact-erlang (very pre-alpha phase right now)
%% Setup
PactRef = pact:create_new_pact(<<"consumer">>, <<"producer">>).
InteractionRef = pact:create_new_interaction(PactRef, <<"/users api desc">>).
pact:insert_request_path(InteractionRef, <<"GET">>, <<"/users">>).
ResponseJsonString = jsx:encode(#{auth_id => 1}).
pact:insert_response_body(InteractionRef, <<"application/json">>, ResponseJsonString).
pact:insert_response_status(InteractionRef, 200).
pact:create_mock_server(PactRef, <<"localhost">>, 1234, <<"http">>).
%% Sample test code
Users = user:get_users(),
%% Verify
assertEqual({ok, matched}, pact:verify_pact(1234)).
%% Write Pact File
pact:write_pact_file(PactRef, "/Users/priyaranjan.m/pacts", 0)
%% Cleanup test setup
pact:cleanup_pact_setup()
Priyaranjan Mudliar
05/17/2023, 9:56 AMPriyaranjan Mudliar
05/17/2023, 10:00 AMPriyaranjan Mudliar
05/17/2023, 10:04 AMPriyaranjan Mudliar
05/17/2023, 11:48 AMAs long as Elixr can speak a c interface (which it obviously can, because that is what Rustler ultimately does) and you can add a c compatible library to your package (which it sounds like you can), I?d strongly encourage you move away from having the need for rust on a target machine
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
insert_<fn>
is a bit different to DSLs in the other languages, i’d encourage you to take a look at the latest .NET / JVM / JS / Go to get an ideaPriyaranjan Mudliar
05/18/2023, 7:42 AMPriyaranjan Mudliar
05/18/2023, 7:43 AMMatt (pactflow.io / pact-js / pact-go)