@@ -52,7 +52,7 @@ impl TokenTest {
5252pub struct PredictifyTest < ' a > {
5353 pub env : Env ,
5454 pub contract_id : Address ,
55- pub token_test : TokenTest < ' a > ,
55+ pub token_test : TokenTest ,
5656
5757 pub admin : Address ,
5858 pub user : Address ,
@@ -115,11 +115,9 @@ impl<'a> PredictifyTest<'a> {
115115 let client = PredictifyHybridClient :: new ( & self . env , & self . contract_id ) ;
116116
117117 // Create market outcomes
118- let outcomes = vec ! [
119- & self . env,
120- String :: from_str( & self . env, "yes" ) ,
121- String :: from_str( & self . env, "no" ) ,
122- ] ;
118+ let mut outcomes = Vec :: new ( & self . env ) ;
119+ outcomes. push_back ( String :: from_str ( & self . env , "yes" ) ) ;
120+ outcomes. push_back ( String :: from_str ( & self . env , "no" ) ) ;
123121
124122 // Create market
125123 self . env . mock_all_auths ( ) ;
@@ -136,6 +134,15 @@ impl<'a> PredictifyTest<'a> {
136134 } ,
137135 )
138136 }
137+
138+ pub fn create_default_oracle_config ( & self ) -> OracleConfig {
139+ OracleConfig :: new (
140+ OracleProvider :: Pyth ,
141+ String :: from_str ( & self . env , "BTC/USD" ) ,
142+ 2500000 ,
143+ String :: from_str ( & self . env , "gt" ) ,
144+ )
145+ }
139146}
140147
141148// Core functionality tests
@@ -144,11 +151,9 @@ fn test_create_market_successful() {
144151 let test = PredictifyTest :: setup ( ) ;
145152 let client = PredictifyHybridClient :: new ( & test. env , & test. contract_id ) ;
146153 let duration_days = 30 ;
147- let outcomes = vec ! [
148- & test. env,
149- String :: from_str( & test. env, "yes" ) ,
150- String :: from_str( & test. env, "no" ) ,
151- ] ;
154+ let mut outcomes = Vec :: new ( & test. env ) ;
155+ outcomes. push_back ( String :: from_str ( & test. env , "yes" ) ) ;
156+ outcomes. push_back ( String :: from_str ( & test. env , "no" ) ) ;
152157
153158 // Create market
154159 let market_id = client. create_market (
@@ -188,11 +193,9 @@ fn test_create_market_successful() {
188193fn test_create_market_with_non_admin ( ) {
189194 let test = PredictifyTest :: setup ( ) ;
190195 let client = PredictifyHybridClient :: new ( & test. env , & test. contract_id ) ;
191- let outcomes = vec ! [
192- & test. env,
193- String :: from_str( & test. env, "yes" ) ,
194- String :: from_str( & test. env, "no" ) ,
195- ] ;
196+ let mut outcomes = Vec :: new ( & test. env ) ;
197+ outcomes. push_back ( String :: from_str ( & test. env , "yes" ) ) ;
198+ outcomes. push_back ( String :: from_str ( & test. env , "no" ) ) ;
196199
197200 client. create_market (
198201 & test. user ,
@@ -213,7 +216,7 @@ fn test_create_market_with_non_admin() {
213216fn test_create_market_with_empty_outcome ( ) {
214217 let test = PredictifyTest :: setup ( ) ;
215218 let client = PredictifyHybridClient :: new ( & test. env , & test. contract_id ) ;
216- let outcomes = vec ! [ & test. env] ;
219+ let outcomes = Vec :: new ( & test. env ) ;
217220
218221 client. create_market (
219222 & test. admin ,
@@ -234,11 +237,9 @@ fn test_create_market_with_empty_outcome() {
234237fn test_create_market_with_empty_question ( ) {
235238 let test = PredictifyTest :: setup ( ) ;
236239 let client = PredictifyHybridClient :: new ( & test. env , & test. contract_id ) ;
237- let outcomes = vec ! [
238- & test. env,
239- String :: from_str( & test. env, "yes" ) ,
240- String :: from_str( & test. env, "no" ) ,
241- ] ;
240+ let mut outcomes = Vec :: new ( & test. env ) ;
241+ outcomes. push_back ( String :: from_str ( & test. env , "yes" ) ) ;
242+ outcomes. push_back ( String :: from_str ( & test. env , "no" ) ) ;
242243
243244 client. create_market (
244245 & test. admin ,
@@ -443,7 +444,6 @@ fn test_question_length_validation() {
443444 & test. env,
444445 String :: from_str( & test. env, "yes" ) ,
445446 String :: from_str( & test. env, "no" ) ,
446- ] ;
447447
448448 // Test maximum question length (should not exceed 500 characters)
449449 let long_question = "a" . repeat( 501 ) ;
@@ -2395,7 +2395,6 @@ fn test_event_helpers_create_context() {
23952395 String :: from_str( & test. env, "Market" ) ,
23962396 String :: from_str( & test. env, "Vote" ) ,
23972397 String :: from_str( & test. env, "User" ) ,
2398- ] ;
23992398
24002399 let context = client. create_event_context( & context_parts) ;
24012400
@@ -2432,7 +2431,6 @@ fn test_event_documentation_event_types() {
24322431 String :: from_str( & test. env, "MarketResolved" ) ,
24332432 String :: from_str( & test. env, "DisputeCreated" ) ,
24342433 String :: from_str( & test. env, "FeeCollected" ) ,
2435- ] ;
24362434
24372435 for event_type in event_types. iter( ) {
24382436 // Verify documentation exists for each event type
@@ -2456,7 +2454,6 @@ fn test_event_documentation_usage_examples() {
24562454 String :: from_str( & test. env, "EmitVoteCast" ) ,
24572455 String :: from_str( & test. env, "GetMarketEvents" ) ,
24582456 String :: from_str( & test. env, "ValidateEvent" ) ,
2459- ] ;
24602457
24612458 for example_type in example_types. iter( ) {
24622459 // Verify examples exist for each type
@@ -2481,7 +2478,6 @@ fn test_event_testing_utilities() {
24812478 String :: from_str( & test. env, "FeeCollected" ) ,
24822479 String :: from_str( & test. env, "ErrorLogged" ) ,
24832480 String :: from_str( & test. env, "PerformanceMetric" ) ,
2484- ] ;
24852481
24862482 for event_type in event_types. iter( ) {
24872483 let success = client. create_test_event( & event_type) ;
@@ -2711,7 +2707,6 @@ fn test_market_validation_creation() {
27112707 & test. env,
27122708 String :: from_str( & test. env, "yes" ) ,
27132709 String :: from_str( & test. env, "no" ) ,
2714- ] ;
27152710
27162711 let oracle_config = test. create_default_oracle_config( ) ;
27172712
@@ -2738,7 +2733,6 @@ fn test_market_validation_invalid_question() {
27382733 & test. env,
27392734 String :: from_str( & test. env, "yes" ) ,
27402735 String :: from_str( & test. env, "no" ) ,
2741- ] ;
27422736
27432737 let oracle_config = test. create_default_oracle_config( ) ;
27442738
@@ -2763,7 +2757,6 @@ fn test_market_validation_invalid_outcomes() {
27632757 let invalid_outcomes = vec![
27642758 & test. env,
27652759 String :: from_str( & test. env, "yes" ) ,
2766- ] ;
27672760
27682761 let oracle_config = test. create_default_oracle_config( ) ;
27692762
@@ -2789,7 +2782,6 @@ fn test_market_validation_invalid_duration() {
27892782 & test. env,
27902783 String :: from_str( & test. env, "yes" ) ,
27912784 String :: from_str( & test. env, "no" ) ,
2792- ] ;
27932785
27942786 let oracle_config = test. create_default_oracle_config( ) ;
27952787
@@ -3113,7 +3105,6 @@ fn test_comprehensive_validation_scenario() {
31133105 & test. env,
31143106 String :: from_str( & test. env, "yes" ) ,
31153107 String :: from_str( & test. env, "no" ) ,
3116- ] ;
31173108
31183109 let oracle_config = test. create_default_oracle_config( ) ;
31193110
@@ -3169,7 +3160,6 @@ fn test_validation_error_handling() {
31693160 let invalid_outcomes = vec![
31703161 & test. env,
31713162 String :: from_str( & test. env, "yes" ) , // Only one outcome
3172- ] ;
31733163
31743164 let oracle_config = test. create_default_oracle_config( ) ;
31753165
@@ -3195,7 +3185,6 @@ fn test_validation_warnings_and_recommendations() {
31953185 & test. env,
31963186 String :: from_str( & test. env, "yes" ) ,
31973187 String :: from_str( & test. env, "no" ) ,
3198- ] ;
31993188
32003189 let oracle_config = test. create_default_oracle_config( ) ;
32013190
0 commit comments