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

Function TestUpdateNote

pkg/server/controllers/notes_test.go:447–611  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

445}
446
447func TestUpdateNote(t *testing.T) {
448 updatedBody := "some updated content"
449
450 b1UUID := "37868a8e-a844-4265-9a4f-0be598084733"
451 b2UUID := "8f3bd424-6aa5-4ed5-910d-e5b38ab09f8c"
452
453 type payloadData struct {
454 Content *string `schema:"content" json:"content,omitempty"`
455 BookUUID *string `schema:"book_uuid" json:"book_uuid,omitempty"`
456 }
457
458 testCases := []struct {
459 payload testutils.PayloadWrapper
460 noteUUID string
461 noteBookUUID string
462 noteBody string
463 noteDeleted bool
464 expectedNoteBody string
465 expectedNoteBookName string
466 expectedNoteBookUUID string
467 }{
468 {
469 payload: testutils.PayloadWrapper{
470 Data: payloadData{
471 Content: &updatedBody,
472 },
473 },
474 noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
475 noteBookUUID: b1UUID,
476 noteBody: "original content",
477 noteDeleted: false,
478 expectedNoteBookUUID: b1UUID,
479 expectedNoteBody: "some updated content",
480 expectedNoteBookName: "css",
481 },
482 {
483 payload: testutils.PayloadWrapper{
484 Data: payloadData{
485 BookUUID: &b1UUID,
486 },
487 },
488 noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
489 noteBookUUID: b1UUID,
490 noteBody: "original content",
491 noteDeleted: false,
492 expectedNoteBookUUID: b1UUID,
493 expectedNoteBody: "original content",
494 expectedNoteBookName: "css",
495 },
496 {
497 payload: testutils.PayloadWrapper{
498 Data: payloadData{
499 BookUUID: &b2UUID,
500 },
501 },
502 noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
503 noteBookUUID: b1UUID,
504 noteBody: "original content",

Callers

nothing calls this directly

Calls 14

InitMemoryDBFunction · 0.92
NewTestFunction · 0.92
NewMockFunction · 0.92
SetupUserDataFunction · 0.92
MustExecFunction · 0.92
MakeReqFunction · 0.92
HTTPAuthDoFunction · 0.92
StatusCodeEqualsFunction · 0.92
EqualfFunction · 0.92
EqualFunction · 0.92
MustNewServerFunction · 0.85
ToJSONMethod · 0.80

Tested by

no test coverage detected