Compare commits
No commits in common. "85efd2ac6e99e720dc9858cc86a40feae62b0c5a" and "c8a5391435fe7bee9839072d30fa60a9d1754dd4" have entirely different histories.
85efd2ac6e
...
c8a5391435
@ -13,9 +13,13 @@ type Step struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Step) MatchesExpectedContent(content []byte) (bool, error) {
|
func (s *Step) MatchesExpectedContent(content []byte) (bool, error) {
|
||||||
pattern := regexp.QuoteMeta(s.ExpectedContent)
|
pattern := `.*\?.*|.*`
|
||||||
re, _ := regexp.Compile(pattern)
|
re, err := regexp.Compile(pattern)
|
||||||
if re.Match([]byte(content)) {
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
// Check if the content matches the regex pattern
|
||||||
|
if re.Match(content) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
@ -34,8 +38,7 @@ type TestCase struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TestCase) MatchesExpectedContent(content []byte) (bool, error) {
|
func (s *TestCase) MatchesExpectedContent(content []byte) (bool, error) {
|
||||||
pattern := regexp.QuoteMeta(s.ExpectedContent)
|
re, err := regexp.Compile(s.ExpectedContent)
|
||||||
re, err := regexp.Compile(pattern)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,6 @@ func TestSendWithInvalidInputs(t *testing.T) {
|
|||||||
|
|
||||||
// Replace placeholder {public_key} with the actual dynamic public key
|
// Replace placeholder {public_key} with the actual dynamic public key
|
||||||
expectedContent := bytes.Replace([]byte(step.ExpectedContent), []byte("{public_key}"), []byte(publicKey), -1)
|
expectedContent := bytes.Replace([]byte(step.ExpectedContent), []byte("{public_key}"), []byte(publicKey), -1)
|
||||||
step.ExpectedContent = string(expectedContent)
|
|
||||||
match, err := step.MatchesExpectedContent(b)
|
match, err := step.MatchesExpectedContent(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error compiling regex for step '%s': %v", step.Input, err)
|
t.Fatalf("Error compiling regex for step '%s': %v", step.Input, err)
|
||||||
@ -339,7 +338,6 @@ func TestMyAccount_MyAddress(t *testing.T) {
|
|||||||
|
|
||||||
publicKey := extractPublicKey(b)
|
publicKey := extractPublicKey(b)
|
||||||
expectedContent := bytes.Replace([]byte(step.ExpectedContent), []byte("{public_key}"), []byte(publicKey), -1)
|
expectedContent := bytes.Replace([]byte(step.ExpectedContent), []byte("{public_key}"), []byte(publicKey), -1)
|
||||||
step.ExpectedContent = string(expectedContent)
|
|
||||||
match, err := step.MatchesExpectedContent(b)
|
match, err := step.MatchesExpectedContent(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error compiling regex for step '%s': %v", step.Input, err)
|
t.Fatalf("Error compiling regex for step '%s': %v", step.Input, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user