Skip to content

Commit 72d90a3

Browse files
committed
Merge pull request #13 from nathany/raw_string
notification test: use raw strings for JSON
2 parents e214012 + ced0b0e commit 72d90a3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

notification_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/binary"
66
"encoding/json"
77
"time"
8+
89
. "github.com/onsi/ginkgo"
910
. "github.com/onsi/gomega"
1011
"github.com/timehop/apns"
@@ -20,7 +21,7 @@ var _ = Describe("Notifications", func() {
2021
j, err := json.Marshal(a)
2122

2223
Expect(err).To(BeNil())
23-
Expect(j).To(Equal([]byte("{\"body\":\"whatup\"}")))
24+
Expect(j).To(Equal([]byte(`{"body":"whatup"}`)))
2425
})
2526
})
2627

@@ -31,7 +32,7 @@ var _ = Describe("Notifications", func() {
3132
j, err := json.Marshal(a)
3233

3334
Expect(err).To(BeNil())
34-
Expect(j).To(Equal([]byte("{\"loc-key\":\"localization\"}")))
35+
Expect(j).To(Equal([]byte(`{"loc-key":"localization"}`)))
3536
})
3637
})
3738

@@ -42,7 +43,7 @@ var _ = Describe("Notifications", func() {
4243
j, err := json.Marshal(a)
4344

4445
Expect(err).To(BeNil())
45-
Expect(j).To(Equal([]byte("{\"loc-args\":[\"world\",\"cup\"]}")))
46+
Expect(j).To(Equal([]byte(`{"loc-args":["world","cup"]}`)))
4647
})
4748
})
4849

@@ -53,7 +54,7 @@ var _ = Describe("Notifications", func() {
5354
j, err := json.Marshal(a)
5455

5556
Expect(err).To(BeNil())
56-
Expect(j).To(Equal([]byte("{\"action-loc-key\":\"akshun localization\"}")))
57+
Expect(j).To(Equal([]byte(`{"action-loc-key":"akshun localization"}`)))
5758
})
5859
})
5960

@@ -64,7 +65,7 @@ var _ = Describe("Notifications", func() {
6465
j, err := json.Marshal(a)
6566

6667
Expect(err).To(BeNil())
67-
Expect(j).To(Equal([]byte("{\"launch-image\":\"dee fault\"}")))
68+
Expect(j).To(Equal([]byte(`{"launch-image":"dee fault"}`)))
6869
})
6970
})
7071

@@ -75,7 +76,7 @@ var _ = Describe("Notifications", func() {
7576
j, err := json.Marshal(a)
7677

7778
Expect(err).To(BeNil())
78-
Expect(j).To(Equal([]byte("{\"body\":\"USA scores!\",\"loc-key\":\"game\",\"loc-args\":[\"USA\",\"BRA\"],\"launch-image\":\"scoreboard\"}")))
79+
Expect(j).To(Equal([]byte(`{"body":"USA scores!","loc-key":"game","loc-args":["USA","BRA"],"launch-image":"scoreboard"}`)))
7980
})
8081
})
8182
})
@@ -92,7 +93,7 @@ var _ = Describe("Notifications", func() {
9293
b, err := json.Marshal(p)
9394

9495
Expect(err).To(BeNil())
95-
Expect(b).To(Equal([]byte("{\"aps\":{\"alert\":{\"body\":\"testing\"}}}")))
96+
Expect(b).To(Equal([]byte(`{"aps":{"alert":{"body":"testing"}}}`)))
9697
})
9798
})
9899

@@ -106,7 +107,7 @@ var _ = Describe("Notifications", func() {
106107
b, err := json.Marshal(p)
107108

108109
Expect(err).To(BeNil())
109-
Expect(b).To(Equal([]byte("{\"aps\":{\"alert\":{\"body\":\"testing\"}},\"email\":\"[email protected]\"}")))
110+
Expect(b).To(Equal([]byte(`{"aps":{"alert":{"body":"testing"}},"email":"[email protected]"}`)))
110111
})
111112
})
112113
})

0 commit comments

Comments
 (0)