@@ -13,6 +13,7 @@ use notarization::core::notarization::OnChainNotarization;
1313use notarization:: core:: state:: { Data , State } ;
1414use notarization:: core:: timelock:: TimeLock ;
1515use notarization:: core:: NotarizationMethod ;
16+ use product_common:: core_client:: CoreClientReadOnly ;
1617
1718#[ tokio:: test]
1819async fn create_simple_dynamic_notarization_works ( ) -> anyhow:: Result < ( ) > {
@@ -27,8 +28,6 @@ async fn create_simple_dynamic_notarization_works() -> anyhow::Result<()> {
2728 . await ?
2829 . output ;
2930
30- println ! ( "onchain_notarization: {:?}" , onchain_notarization) ;
31-
3231 assert_eq ! (
3332 onchain_notarization. immutable_metadata. description,
3433 Some ( "Test Notarization" . to_string( ) )
@@ -145,7 +144,7 @@ async fn test_update_state_dynamic_notarization() -> anyhow::Result<()> {
145144 . id ;
146145
147146 let new_state = State :: from_string ( "updated_state" . to_string ( ) , Some ( "state_metadata" . to_string ( ) ) ) ;
148-
147+
149148 let update_result = test_client
150149 . update_state ( new_state. clone ( ) , * notarization_id. object_id ( ) )
151150 . build_and_execute ( & mut test_client)
@@ -154,7 +153,7 @@ async fn test_update_state_dynamic_notarization() -> anyhow::Result<()> {
154153 assert ! ( update_result. is_ok( ) , "State update should succeed" ) ;
155154
156155 let retrieved_state = test_client. state ( * notarization_id. object_id ( ) ) . await ?;
157- assert_eq ! ( retrieved_state. data. as_string ( ) ?, "updated_state" ) ;
156+ assert_eq ! ( retrieved_state. data. as_text ( ) ?, "updated_state" ) ;
158157 assert_eq ! ( retrieved_state. metadata, Some ( "state_metadata" . to_string( ) ) ) ;
159158
160159 let version_count = test_client. state_version_count ( * notarization_id. object_id ( ) ) . await ?;
@@ -179,7 +178,7 @@ async fn test_update_metadata_dynamic_notarization() -> anyhow::Result<()> {
179178 . id ;
180179
181180 let new_metadata = Some ( "updated_metadata" . to_string ( ) ) ;
182-
181+
183182 let update_result = test_client
184183 . update_metadata ( new_metadata. clone ( ) , * notarization_id. object_id ( ) )
185184 . build_and_execute ( & mut test_client)
@@ -215,7 +214,10 @@ async fn test_destroy_dynamic_notarization_no_locks() -> anyhow::Result<()> {
215214 . build_and_execute ( & mut test_client)
216215 . await ;
217216
218- assert ! ( destroy_result. is_ok( ) , "Destroy should succeed for unlocked notarization" ) ;
217+ assert ! (
218+ destroy_result. is_ok( ) ,
219+ "Destroy should succeed for unlocked notarization"
220+ ) ;
219221
220222 Ok ( ( ) )
221223}
@@ -254,10 +256,13 @@ async fn test_read_only_methods_dynamic_notarization() -> anyhow::Result<()> {
254256
255257 let description = "Test Description" . to_string ( ) ;
256258 let updateable_metadata = "Test Metadata" . to_string ( ) ;
257-
259+
258260 let notarization_id = test_client
259261 . create_dynamic_notarization ( )
260- . with_state ( State :: from_string ( "test_state" . to_string ( ) , Some ( "state_meta" . to_string ( ) ) ) )
262+ . with_state ( State :: from_string (
263+ "test_state" . to_string ( ) ,
264+ Some ( "state_meta" . to_string ( ) ) ,
265+ ) )
261266 . with_immutable_description ( description. clone ( ) )
262267 . with_updateable_metadata ( updateable_metadata. clone ( ) )
263268 . finish ( )
@@ -273,7 +278,7 @@ async fn test_read_only_methods_dynamic_notarization() -> anyhow::Result<()> {
273278 assert_eq ! ( retrieved_metadata, Some ( updateable_metadata) ) ;
274279
275280 let state = test_client. state ( * notarization_id. object_id ( ) ) . await ?;
276- assert_eq ! ( state. data. as_string ( ) ?, "test_state" ) ;
281+ assert_eq ! ( state. data. as_text ( ) ?, "test_state" ) ;
277282 assert_eq ! ( state. metadata, Some ( "state_meta" . to_string( ) ) ) ;
278283
279284 let created_at = test_client. created_at_ts ( * notarization_id. object_id ( ) ) . await ?;
@@ -317,14 +322,38 @@ async fn test_lock_checking_methods() -> anyhow::Result<()> {
317322 . output
318323 . id ;
319324
320- assert ! ( test_client. is_transfer_locked( * locked_notarization_id. object_id( ) ) . await ?) ;
321- assert ! ( !test_client. is_transfer_locked( * unlocked_notarization_id. object_id( ) ) . await ?) ;
325+ assert ! (
326+ test_client
327+ . is_transfer_locked( * locked_notarization_id. object_id( ) )
328+ . await ?
329+ ) ;
330+ assert ! (
331+ !test_client
332+ . is_transfer_locked( * unlocked_notarization_id. object_id( ) )
333+ . await ?
334+ ) ;
322335
323- assert ! ( !test_client. is_update_locked( * locked_notarization_id. object_id( ) ) . await ?) ;
324- assert ! ( !test_client. is_update_locked( * unlocked_notarization_id. object_id( ) ) . await ?) ;
336+ assert ! (
337+ !test_client
338+ . is_update_locked( * locked_notarization_id. object_id( ) )
339+ . await ?
340+ ) ;
341+ assert ! (
342+ !test_client
343+ . is_update_locked( * unlocked_notarization_id. object_id( ) )
344+ . await ?
345+ ) ;
325346
326- assert ! ( !test_client. is_destroy_locked( * locked_notarization_id. object_id( ) ) . await ?) ;
327- assert ! ( !test_client. is_destroy_locked( * unlocked_notarization_id. object_id( ) ) . await ?) ;
347+ assert ! (
348+ !test_client
349+ . is_destroy_locked( * locked_notarization_id. object_id( ) )
350+ . await ?
351+ ) ;
352+ assert ! (
353+ !test_client
354+ . is_destroy_locked( * unlocked_notarization_id. object_id( ) )
355+ . await ?
356+ ) ;
328357
329358 let lock_metadata_locked = test_client. lock_metadata ( * locked_notarization_id. object_id ( ) ) . await ?;
330359 assert ! ( lock_metadata_locked. is_some( ) ) ;
@@ -350,7 +379,7 @@ async fn test_multiple_state_updates() -> anyhow::Result<()> {
350379
351380 for i in 1 ..=3 {
352381 let new_state = State :: from_string ( format ! ( "state_v{}" , i) , Some ( format ! ( "metadata_{}" , i) ) ) ;
353-
382+
354383 test_client
355384 . update_state ( new_state, * notarization_id. object_id ( ) )
356385 . build_and_execute ( & mut test_client)
@@ -360,7 +389,7 @@ async fn test_multiple_state_updates() -> anyhow::Result<()> {
360389 assert_eq ! ( version_count, i as u64 ) ;
361390
362391 let state = test_client. state ( * notarization_id. object_id ( ) ) . await ?;
363- assert_eq ! ( state. data. as_string ( ) ?, format!( "state_v{}" , i) ) ;
392+ assert_eq ! ( state. data. as_text ( ) ?, format!( "state_v{}" , i) ) ;
364393 assert_eq ! ( state. metadata, Some ( format!( "metadata_{}" , i) ) ) ;
365394 }
366395
@@ -386,7 +415,7 @@ async fn test_bytes_state_operations() -> anyhow::Result<()> {
386415
387416 let updated_data = vec ! [ 10 , 20 , 30 ] ;
388417 let new_state = State :: from_bytes ( updated_data. clone ( ) , Some ( "bytes_metadata" . to_string ( ) ) ) ;
389-
418+
390419 test_client
391420 . update_state ( new_state, * notarization_id. object_id ( ) )
392421 . build_and_execute ( & mut test_client)
0 commit comments