Commit 94878ec5b8
Verified · cmc
docs/plans/2026-09-20-ios-push-notifications.md +9 −5
| @@ -105,8 +105,7 @@ func TestPushDevices(t *testing.T) { | ||
| 105 | 105 | s := testStore(t) |
| 106 | 106 | uid := testUser(t, s, "alice") |
| 107 | 107 | |
| 108 | id, err := s.AddPushDevice(uid, "tok-a", "iphone") | |
| 109 | if err != nil { | |
| 108 | if _, err := s.AddPushDevice(uid, "tok-a", "iphone"); err != nil { | |
| 110 | 109 | t.Fatalf("AddPushDevice: %v", err) |
| 111 | 110 | } |
| 112 | 111 | devices, err := s.PushDevices(uid) |
| @@ -141,7 +140,6 @@ func TestPushDevices(t *testing.T) { | ||
| 141 | 140 | if d, _ := s.PushDevices(bob); len(d) != 0 { |
| 142 | 141 | t.Fatalf("device survived removal: %+v", d) |
| 143 | 142 | } |
| 144 | _ = id | |
| 145 | 143 | } |
| 146 | 144 | |
| 147 | 145 | func TestPushEnabledDefaultsOn(t *testing.T) { |
| @@ -806,7 +804,7 @@ Ref #89" | ||
| 806 | 804 | - Test: `internal/push/token_test.go` |
| 807 | 805 | |
| 808 | 806 | **Interfaces:** |
| 809 | - Consumes: `config.Push`, `config.LoadAPNSKey` from Task 3. | |
| 807 | - Consumes: nothing. `token.go` takes a parsed key and two strings; it imports no `config` symbol. | |
| 810 | 808 | - Produces: |
| 811 | 809 | - `type tokenSource struct { key *ecdsa.PrivateKey; keyID, teamID string; now func() time.Time; mu sync.Mutex; cached string; issued time.Time }` |
| 812 | 810 | - `func newTokenSource(key *ecdsa.PrivateKey, keyID, teamID string) *tokenSource` |
| @@ -1146,9 +1144,15 @@ func TestSendMapsResponses(t *testing.T) { | ||
| 1146 | 1144 | io.WriteString(w, tc.body) |
| 1147 | 1145 | }) |
| 1148 | 1146 | res, after, err := c.Send(context.Background(), "T", "t", "b", "p") |
| 1149 | if err != nil && tc.want != resultDead && tc.want != resultReap { | |
| 1147 | // Only a delivered push has no error. Every other result | |
| 1148 | // carries the status and reason, which is what the drainer | |
| 1149 | // records on the queue row. | |
| 1150 | if tc.want == resultSent && err != nil { | |
| 1150 | 1151 | t.Fatalf("err = %v", err) |
| 1151 | 1152 | } |
| 1153 | if tc.want != resultSent && err == nil { | |
| 1154 | t.Fatalf("want an error explaining %v, got nil", tc.want) | |
| 1155 | } | |
| 1152 | 1156 | if res != tc.want { |
| 1153 | 1157 | t.Fatalf("res = %v, want %v", res, tc.want) |
| 1154 | 1158 | } |