(t *testing.T, ctx context.Context, s *UsersStore)
| 927 | } |
| 928 | |
| 929 | func usersListFollowers(t *testing.T, ctx context.Context, s *UsersStore) { |
| 930 | john, err := s.Create(ctx, "john", "john@example.com", CreateUserOptions{}) |
| 931 | require.NoError(t, err) |
| 932 | |
| 933 | got, err := s.ListFollowers(ctx, john.ID, 1, 1) |
| 934 | require.NoError(t, err) |
| 935 | assert.Empty(t, got) |
| 936 | |
| 937 | alice, err := s.Create(ctx, "alice", "alice@example.com", CreateUserOptions{}) |
| 938 | require.NoError(t, err) |
| 939 | bob, err := s.Create(ctx, "bob", "bob@example.com", CreateUserOptions{}) |
| 940 | require.NoError(t, err) |
| 941 | |
| 942 | err = s.Follow(ctx, alice.ID, john.ID) |
| 943 | require.NoError(t, err) |
| 944 | err = s.Follow(ctx, bob.ID, john.ID) |
| 945 | require.NoError(t, err) |
| 946 | |
| 947 | // First page only has bob |
| 948 | got, err = s.ListFollowers(ctx, john.ID, 1, 1) |
| 949 | require.NoError(t, err) |
| 950 | require.Len(t, got, 1) |
| 951 | assert.Equal(t, bob.ID, got[0].ID) |
| 952 | |
| 953 | // Second page only has alice |
| 954 | got, err = s.ListFollowers(ctx, john.ID, 2, 1) |
| 955 | require.NoError(t, err) |
| 956 | require.Len(t, got, 1) |
| 957 | assert.Equal(t, alice.ID, got[0].ID) |
| 958 | } |
| 959 | |
| 960 | func usersListFollowings(t *testing.T, ctx context.Context, s *UsersStore) { |
| 961 | john, err := s.Create(ctx, "john", "john@example.com", CreateUserOptions{}) |
nothing calls this directly
no test coverage detected