Skip to content

Commit

Permalink
Removes forgetten Geolocation.Parse
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Nov 7, 2024
1 parent 7c9f9c1 commit 949f9d9
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions common/browser_context_options.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package common

import (
"context"
"fmt"

"github.com/grafana/sobek"

"github.com/grafana/xk6-browser/k6ext"
)

// Geolocation represents a geolocation.
Expand Down Expand Up @@ -35,31 +30,6 @@ func (g *Geolocation) Validate() error {
return nil
}

// Parse parses the geolocation options.
func (g *Geolocation) Parse(ctx context.Context, sopts sobek.Value) error { //nolint:cyclop
var newgl Geolocation

if !sobekValueExists(sopts) {
return fmt.Errorf("geolocation options are required")
}

opts := sopts.ToObject(k6ext.Runtime(ctx))
for _, k := range opts.Keys() {
switch k {
case "accuracy":
newgl.Accuracy = opts.Get(k).ToFloat()
case "latitude":
newgl.Latitude = opts.Get(k).ToFloat()
case "longitude":
newgl.Longitude = opts.Get(k).ToFloat()
}
}

*g = newgl

return nil
}

// BrowserContextOptions stores browser context options.
type BrowserContextOptions struct {
AcceptDownloads bool `js:"acceptDownloads"`
Expand Down

0 comments on commit 949f9d9

Please sign in to comment.