mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-05 14:35:20 -04:00
feat(crypto-nodejs): Make Versions a class, not a JS object.
This commit is contained in:
@@ -34,23 +34,23 @@ pub mod types;
|
||||
pub mod vodozemac;
|
||||
|
||||
/// Object containing the versions of the Rust libraries we are using.
|
||||
#[napi(object)]
|
||||
#[napi]
|
||||
pub struct Versions {
|
||||
/// The version of the vodozemac crate.
|
||||
#[napi(getter)]
|
||||
pub vodozemac: &'static str,
|
||||
pub vodozemac: String,
|
||||
|
||||
/// The version of the matrix-sdk-crypto crate.
|
||||
#[napi(getter)]
|
||||
pub matrix_sdk_crypto: &'static str,
|
||||
pub matrix_sdk_crypto: String,
|
||||
}
|
||||
|
||||
/// Get the versions of the Rust libraries we are using.
|
||||
#[napi(js_name = "getVersions")]
|
||||
pub fn get_versions() -> Versions {
|
||||
Versions {
|
||||
vodozemac: matrix_sdk_crypto::vodozemac::VERSION,
|
||||
matrix_sdk_crypto: matrix_sdk_crypto::VERSION,
|
||||
vodozemac: matrix_sdk_crypto::vodozemac::VERSION.to_owned(),
|
||||
matrix_sdk_crypto: matrix_sdk_crypto::VERSION.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,9 @@ describe("Versions", () => {
|
||||
|
||||
expect(versions).toBeInstanceOf(Versions);
|
||||
expect(versions.vodozemac).toBeDefined();
|
||||
expect(versions.matrix_sdk_crypto).toBeDefined();
|
||||
expect(versions.matrixSdkCrypto).toBeDefined();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe(OlmMachine.name, () => {
|
||||
|
||||
Reference in New Issue
Block a user