Skip to content

Commit 173d9e9

Browse files
committed
chore: run go fmt
1 parent 271b0e5 commit 173d9e9

File tree

2 files changed

+60
-60
lines changed

2 files changed

+60
-60
lines changed

event.go

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
package postman
2-
3-
// ListenType defines the kind of script attached to an event.
4-
type ListenType string
5-
6-
const (
7-
// PreRequest script is usually executed before the HTTP request is sent.
8-
PreRequest ListenType = "prerequest"
9-
// Test script is usually executed after the actual HTTP request is sent, and the response is received.
10-
Test ListenType = "test"
11-
)
12-
13-
// A Script is a snippet of Javascript code that can be used to to perform setup or teardown operations on a particular response.
14-
type Script struct {
15-
ID string `json:"id,omitempty"`
16-
Type string `json:"type,omitempty"`
17-
Exec []string `json:"exec,omitempty"`
18-
Src *URL `json:"src,omitempty"`
19-
Name string `json:"name,omitempty"`
20-
}
21-
22-
// An Event defines a script associated with an associated event name.
23-
type Event struct {
24-
ID string `json:"id,omitempty"`
25-
Listen ListenType `json:"listen,omitempty"`
26-
Script *Script `json:"script,omitempty"`
27-
Disabled bool `json:"disabled,omitempty"`
28-
}
29-
30-
// CreateEvent creates a new Event of type text/javascript.
31-
func CreateEvent(listenType ListenType, script []string) *Event {
32-
return &Event{
33-
Listen: listenType,
34-
Script: &Script{
35-
Type: "text/javascript",
36-
Exec: script,
37-
},
38-
}
39-
}
1+
package postman
2+
3+
// ListenType defines the kind of script attached to an event.
4+
type ListenType string
5+
6+
const (
7+
// PreRequest script is usually executed before the HTTP request is sent.
8+
PreRequest ListenType = "prerequest"
9+
// Test script is usually executed after the actual HTTP request is sent, and the response is received.
10+
Test ListenType = "test"
11+
)
12+
13+
// A Script is a snippet of Javascript code that can be used to to perform setup or teardown operations on a particular response.
14+
type Script struct {
15+
ID string `json:"id,omitempty"`
16+
Type string `json:"type,omitempty"`
17+
Exec []string `json:"exec,omitempty"`
18+
Src *URL `json:"src,omitempty"`
19+
Name string `json:"name,omitempty"`
20+
}
21+
22+
// An Event defines a script associated with an associated event name.
23+
type Event struct {
24+
ID string `json:"id,omitempty"`
25+
Listen ListenType `json:"listen,omitempty"`
26+
Script *Script `json:"script,omitempty"`
27+
Disabled bool `json:"disabled,omitempty"`
28+
}
29+
30+
// CreateEvent creates a new Event of type text/javascript.
31+
func CreateEvent(listenType ListenType, script []string) *Event {
32+
return &Event{
33+
Listen: listenType,
34+
Script: &Script{
35+
Type: "text/javascript",
36+
Exec: script,
37+
},
38+
}
39+
}

event_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
package postman
2-
3-
import (
4-
"testing"
5-
6-
"github.com/stretchr/testify/assert"
7-
)
8-
9-
func TestEventCreateEvent(t *testing.T) {
10-
assert.Equal(
11-
t,
12-
&Event{
13-
Listen: Test,
14-
Script: &Script{
15-
Type: "text/javascript",
16-
Exec: []string{"console.log(\"foo\")"},
17-
},
18-
},
19-
CreateEvent(Test, []string{"console.log(\"foo\")"}),
20-
)
21-
}
1+
package postman
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
)
8+
9+
func TestEventCreateEvent(t *testing.T) {
10+
assert.Equal(
11+
t,
12+
&Event{
13+
Listen: Test,
14+
Script: &Script{
15+
Type: "text/javascript",
16+
Exec: []string{"console.log(\"foo\")"},
17+
},
18+
},
19+
CreateEvent(Test, []string{"console.log(\"foo\")"}),
20+
)
21+
}

0 commit comments

Comments
 (0)