MCPcopy Index your code
hub / github.com/dnote/dnote / TestCheckBookInList

Function TestCheckBookInList

pkg/cli/cmd/sync/sync_test.go:3023–3083  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3021}
3022
3023func TestCheckBookInList(t *testing.T) {
3024 list := syncList{
3025 Notes: map[string]client.SyncFragNote{
3026 "n1-uuid": {
3027 UUID: "n1-uuid",
3028 },
3029 "n2-uuid": {
3030 UUID: "n2-uuid",
3031 },
3032 },
3033 Books: map[string]client.SyncFragBook{
3034 "b1-uuid": {
3035 UUID: "b1-uuid",
3036 },
3037 "b2-uuid": {
3038 UUID: "b2-uuid",
3039 },
3040 },
3041 ExpungedNotes: map[string]bool{
3042 "n3-uuid": true,
3043 "n4-uuid": true,
3044 },
3045 ExpungedBooks: map[string]bool{
3046 "b3-uuid": true,
3047 "b4-uuid": true,
3048 },
3049 MaxUSN: 1,
3050 MaxCurrentTime: 2,
3051 }
3052
3053 testCases := []struct {
3054 uuid string
3055 expected bool
3056 }{
3057 {
3058 uuid: "b1-uuid",
3059 expected: true,
3060 },
3061 {
3062 uuid: "b2-uuid",
3063 expected: true,
3064 },
3065 {
3066 uuid: "b3-uuid",
3067 expected: true,
3068 },
3069 {
3070 uuid: "b4-uuid",
3071 expected: true,
3072 },
3073 {
3074 uuid: "nonexistent-book-uuid",
3075 expected: false,
3076 },
3077 }
3078
3079 for idx, tc := range testCases {
3080 got := checkBookInList(tc.uuid, &list)

Callers

nothing calls this directly

Calls 2

EqualFunction · 0.92
checkBookInListFunction · 0.85

Tested by

no test coverage detected