(t *testing.T)
| 218 | } |
| 219 | |
| 220 | func Test_WatchKey(t *testing.T) { |
| 221 | ddbMock := NewDynamodbClientMock() |
| 222 | codecMock := &CodecMock{} |
| 223 | descMock := &DescMock{} |
| 224 | c := NewClientMock(ddbMock, codecMock, TestLogger{}, prometheus.NewPedanticRegistry(), 1*time.Second, defaultBackoff) |
| 225 | timesCalled := 0 |
| 226 | |
| 227 | ddbMock.On("Query").Return(map[string]dynamodbItem{}, nil) |
| 228 | codecMock.On("DecodeMultiKey").Return(descMock, nil) |
| 229 | |
| 230 | c.WatchKey(context.TODO(), key, func(i any) bool { |
| 231 | timesCalled++ |
| 232 | ddbMock.AssertNumberOfCalls(t, "Query", timesCalled) |
| 233 | codecMock.AssertNumberOfCalls(t, "DecodeMultiKey", timesCalled) |
| 234 | require.EqualValues(t, descMock, i) |
| 235 | return timesCalled < 5 |
| 236 | }) |
| 237 | } |
| 238 | |
| 239 | func Test_WatchKey_UpdateStale(t *testing.T) { |
| 240 | ddbMock := NewDynamodbClientMock() |
nothing calls this directly
no test coverage detected