func TestBankTransactionCodeSubCode(t *testing.T) {
	var err error
	emptyContext := &model.Context{}

	testCase := model.TestCase{
		Input:  model.Input{Method: "GET", Endpoint: "/open-banking/v3.1/aisp/accounts/00000005/transactions"},
		Expect: model.Expect{SchemaValidation: true}}

	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.7 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath317)
		if err != nil {
			t.Fatal(err)
		}

		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})

	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.6 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath316)
		if err != nil {
			t.Fatal(err)
		}

		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})

	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.5 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath315)
		if err != nil {
			t.Fatal(err)
		}

		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})

	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.4 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath314)
		if err != nil {
			t.Fatal(err)
		}

		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})

	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.3 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath313)
		if err != nil {
			t.Fatal(err)
		}

		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})

}
// Tests to check for issues with Code and Subcode swagger field lengths
// Fields should be unrestricted, not limited to 4 Characters
// See REFAPP-1083
Tests to check for issues with Code and Subcode swagger field lengths
Fields should be unrestricted, not limited to 4 Characters
See REFAPP-1083
// Tests to check for issues with Code and Subcode swagger field lengths // Fields should be unrestricted not limited to 4 Characters // See REFAPP - 1083
func TestBankTransactionCodeSubCode(t *testing.T) {
	var err error
	emptyContext := &model.Context{}
	testCase := model.TestCase{
		Input:  model.Input{Method: "GET", Endpoint: "/open-banking/v3.1/aisp/accounts/00000005/transactions"},
		Expect: model.Expect{SchemaValidation: true}}
	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.7 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath317)
		if err != nil {
			t.Fatal(err)
		}
		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})
	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.6 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath316)
		if err != nil {
			t.Fatal(err)
		}
		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})
	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.5 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath315)
		if err != nil {
			t.Fatal(err)
		}
		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})
	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.4 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath314)
		if err != nil {
			t.Fatal(err)
		}
		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})
	t.Run("Transaction with Codes and Subcodes more than 4 chars should PASS 3.1.3 accounts", func(t *testing.T) {
		testCase.Validator, err = schema.NewSwaggerValidator(*accountSpecPath313)
		if err != nil {
			t.Fatal(err)
		}
		resp := test.CreateHTTPResponse(200, "OK", string(transactionData), "Content-Type", "application/json")
		result, err := testCase.Validate(resp, emptyContext)
		if len(err) != 0 {
			t.Fatal(err)
		}
		assert.True(t, result, "expected: %v actual: %v", true, result)
	})
}
func TestBankTransactionCodeSubCode ( t * testing . T ) { var err error emptyContext := & model . Context { } testCase := model . TestCase { Input : model . Input { Method : " " , Endpoint : " " } , Expect : model . Expect { SchemaValidation : true } } t . Run ( " " , func ( t * testing . T ) { testCase . Validator , err = schema . NewSwaggerValidator ( * accountSpecPath317 ) if err != nil { t . Fatal ( err ) } resp := test . CreateHTTPResponse ( 200 , " " , string ( transactionData ) , " " , " " ) result , err := testCase . Validate ( resp , emptyContext ) if len ( err ) != 0 { t . Fatal ( err ) } assert . True ( t , result , " " , true , result ) } ) t . Run ( " " , func ( t * testing . T ) { testCase . Validator , err = schema . NewSwaggerValidator ( * accountSpecPath316 ) if err != nil { t . Fatal ( err ) } resp := test . CreateHTTPResponse ( 200 , " " , string ( transactionData ) , " " , " " ) result , err := testCase . Validate ( resp , emptyContext ) if len ( err ) != 0 { t . Fatal ( err ) } assert . True ( t , result , " " , true , result ) } ) t . Run ( " " , func ( t * testing . T ) { testCase . Validator , err = schema . NewSwaggerValidator ( * accountSpecPath315 ) if err != nil { t . Fatal ( err ) } resp := test . CreateHTTPResponse ( 200 , " " , string ( transactionData ) , " " , " " ) result , err := testCase . Validate ( resp , emptyContext ) if len ( err ) != 0 { t . Fatal ( err ) } assert . True ( t , result , " " , true , result ) } ) t . Run ( " " , func ( t * testing . T ) { testCase . Validator , err = schema . NewSwaggerValidator ( * accountSpecPath314 ) if err != nil { t . Fatal ( err ) } resp := test . CreateHTTPResponse ( 200 , " " , string ( transactionData ) , " " , " " ) result , err := testCase . Validate ( resp , emptyContext ) if len ( err ) != 0 { t . Fatal ( err ) } assert . True ( t , result , " " , true , result ) } ) t . Run ( " " , func ( t * testing . T ) { testCase . Validator , err = schema . NewSwaggerValidator ( * accountSpecPath313 ) if err != nil { t . Fatal ( err ) } resp := test . CreateHTTPResponse ( 200 , " " , string ( transactionData ) , " " , " " ) result , err := testCase . Validate ( resp , emptyContext ) if len ( err ) != 0 { t . Fatal ( err ) } assert . True ( t , result , " " , true , result ) } ) }
Tests to check for issues with Code and Subcode swagger field lengths
Fields should be unrestricted, not limited to 4 Characters
See REFAPP-1083
Tests to check for issues with Code and Subcode swagger field lengths Fields should be unrestricted not limited to 4 Characters See REFAPP - 1083