MCPcopy
hub / github.com/mum4k/termdash / TestUpdate

Function TestUpdate

container/container_test.go:2690–3159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2688}
2689
2690func TestUpdate(t *testing.T) {
2691 tests := []struct {
2692 desc string
2693 termSize image.Point
2694 container func(ft *faketerm.Terminal) (*Container, error)
2695 updateID string
2696 updateOpts []Option
2697 // events are events delivered before the update.
2698 beforeEvents []terminalapi.Event
2699 // events are events delivered after the update.
2700 afterEvents []terminalapi.Event
2701 wantUpdateErr bool
2702 want func(size image.Point) *faketerm.Terminal
2703 }{
2704 {
2705 desc: "fails on empty updateID",
2706 termSize: image.Point{10, 10},
2707 container: func(ft *faketerm.Terminal) (*Container, error) {
2708 return New(ft)
2709 },
2710 wantUpdateErr: true,
2711 },
2712 {
2713 desc: "fails when no container with the ID is found",
2714 termSize: image.Point{10, 10},
2715 container: func(ft *faketerm.Terminal) (*Container, error) {
2716 return New(ft)
2717 },
2718 updateID: "myID",
2719 wantUpdateErr: true,
2720 },
2721 {
2722 desc: "no changes when no options are provided",
2723 termSize: image.Point{10, 10},
2724 container: func(ft *faketerm.Terminal) (*Container, error) {
2725 return New(
2726 ft,
2727 ID("myID"),
2728 Border(linestyle.Light),
2729 )
2730 },
2731 updateID: "myID",
2732 want: func(size image.Point) *faketerm.Terminal {
2733 ft := faketerm.MustNew(size)
2734 cvs := testcanvas.MustNew(ft.Area())
2735 testdraw.MustBorder(
2736 cvs,
2737 image.Rect(0, 0, 10, 10),
2738 draw.BorderCellOpts(cell.FgColor(cell.ColorYellow)),
2739 )
2740 testcanvas.MustApply(cvs, ft)
2741 return ft
2742 },
2743 },
2744 {
2745 desc: "fails on invalid options",
2746 termSize: image.Point{10, 10},
2747 container: func(ft *faketerm.Terminal) (*Container, error) {

Callers

nothing calls this directly

Calls 15

SubscribeMethod · 0.95
handleMethod · 0.95
EventMethod · 0.95
ProcessedMethod · 0.95
MustNewFunction · 0.92
MustNewFunction · 0.92
MustBorderFunction · 0.92
BorderCellOptsFunction · 0.92
FgColorFunction · 0.92
MustApplyFunction · 0.92
NewFunction · 0.92
MustDrawFunction · 0.92

Tested by

no test coverage detected