Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Removes the forgotten Geolocation.Parse #1521

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading