Skip to content

Commit

Permalink
Add a test to for when the method is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Oct 17, 2024
1 parent c9d2182 commit fa26305
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,20 @@ func TestPageOnMetric(t *testing.T) {
wantRegex: `http://127\.0\.0\.1:[0-9]+/ping\?h=[0-9a-z]+`,
wantErr: `name " " is invalid`,
},
{
// We should get an error back when the method is invalid.
name: "with_invalid_name",
fun: `page.on('metric', (metric) => {
metric.tag({
name:'ping-1',
matches: [
{url: /^http:\/\/127\.0\.0\.1\:[0-9]+\/ping\?h=[0-9a-z]+$/, method: 'foo'},
]
});
});`,
wantRegex: `http://127\.0\.0\.1:[0-9]+/ping\?h=[0-9a-z]+`,
wantErr: `method "foo" is invalid`,
},
}

for _, tt := range tests {
Expand Down

0 comments on commit fa26305

Please sign in to comment.