| Conditions | 1 |
| Total Lines | 27 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package httpsms |
||
| 13 | func TestHeartbeatService_Index(t *testing.T) { |
||
| 14 | // Setup |
||
| 15 | t.Parallel() |
||
| 16 | |||
| 17 | // Arrange |
||
| 18 | apiKey := "test-api-key" |
||
| 19 | server := helpers.MakeTestServer(http.StatusOK, stubs.HeartbeatIndexResponse()) |
||
| 20 | client := New(WithBaseURL(server.URL), WithAPIKey(apiKey)) |
||
| 21 | |||
| 22 | // Act |
||
| 23 | heartbeats, response, err := client.Heartbeats.Index(context.Background(), &HeartbeatIndexParams{ |
||
| 24 | Skip: 0, |
||
| 25 | Owner: "+18005550199", |
||
| 26 | Query: nil, |
||
| 27 | Limit: 100, |
||
| 28 | }) |
||
| 29 | |||
| 30 | // Assert |
||
| 31 | assert.Nil(t, err) |
||
| 32 | |||
| 33 | assert.Equal(t, http.StatusOK, response.HTTPResponse.StatusCode) |
||
| 34 | |||
| 35 | jsonContent, _ := json.Marshal(heartbeats) |
||
| 36 | assert.JSONEq(t, string(stubs.HeartbeatIndexResponse()), string(jsonContent)) |
||
| 37 | |||
| 38 | // Teardown |
||
| 39 | server.Close() |
||
| 40 | } |
||
| 67 |