8 "github.com/stretchr/testify/require"
11func TestAttributionMigration(t *testing.T) {
17 expectedTrailer TrailerStyle
21 name: "old setting co_authored_by=true migrates to co-authored-by",
25 "co_authored_by": true,
26 "generated_with": false
30 expectedTrailer: TrailerStyleCoAuthoredBy,
31 expectedGenerate: false,
34 name: "old setting co_authored_by=false migrates to none",
38 "co_authored_by": false,
39 "generated_with": true
43 expectedTrailer: TrailerStyleNone,
44 expectedGenerate: true,
47 name: "new setting takes precedence over old setting",
51 "trailer_style": "assisted-by",
52 "co_authored_by": true,
53 "generated_with": false
57 expectedTrailer: TrailerStyleAssistedBy,
58 expectedGenerate: false,
61 name: "default when neither setting present",
65 "generated_with": true
69 expectedTrailer: TrailerStyleAssistedBy,
70 expectedGenerate: true,
73 name: "default when attribution is null",
77 expectedTrailer: TrailerStyleAssistedBy,
78 expectedGenerate: true,
82 for _, tt := range tests {
83 t.Run(tt.name, func(t *testing.T) {
86 cfg, err := loadFromReaders([]io.Reader{strings.NewReader(tt.configJSON)})
87 require.NoError(t, err)
89 cfg.setDefaults(t.TempDir(), "")
91 require.Equal(t, tt.expectedTrailer, cfg.Options.Attribution.TrailerStyle)
92 require.Equal(t, tt.expectedGenerate, cfg.Options.Attribution.GeneratedWith)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list