Skip to content

Commit

Permalink
Added test for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
schwartz-concordium committed Jan 26, 2024
1 parent c01a00b commit 02d9129
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rust-bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn schema_display_aux(schema: &[u8], schema_version: Option<u8>) -> Result<Vec<u

#[derive(Error, Debug)]
pub enum FFIError {
#[error("{}", 0)]
#[error("{0}")]
JsonError(String),
#[error("error when using serde")]
SerdeJsonError,
Expand Down
8 changes: 6 additions & 2 deletions tests/UnitTests/Interop/InteropBindingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public async Task GivenBadSchema_WhenSchemaDisplay_ThenThrowExceptionWithParseEr

// Assert
action.Should().Throw<InteropBindingException>()
.Where(e => e.Result == Result.VersionedSchemaErrorParseError);
.Where(e =>
e.Result == Result.VersionedSchemaErrorParseError &&
e.Message.Equals("Parse error", StringComparison.Ordinal));
}

[Fact]
Expand Down Expand Up @@ -101,7 +103,9 @@ public async Task GivenBadReceiveParam_WhenDisplayReceiveParam_ThenThrowExceptio

// Assert
action.Should().Throw<InteropBindingException>()
.Where(e => e.Result == Result.NoError);
.Where(e =>
e.Result == Result.JsonError &&
e.Message.StartsWith("Failed to deserialize AccountAddress due to: Could not parse AccountAddress"));
}

[Fact]
Expand Down

0 comments on commit 02d9129

Please sign in to comment.