2019-11-17 17:43:01 +00:00
|
|
|
package sv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2021-02-13 18:40:09 +00:00
|
|
|
"github.com/Masterminds/semver/v3"
|
2019-11-17 17:43:01 +00:00
|
|
|
)
|
|
|
|
|
2023-10-15 19:29:29 +00:00
|
|
|
func TestVersion(v string) *semver.Version {
|
2019-11-17 17:43:01 +00:00
|
|
|
r, _ := semver.NewVersion(v)
|
2023-10-12 14:18:25 +00:00
|
|
|
|
2021-12-29 21:02:50 +00:00
|
|
|
return r
|
2019-11-17 17:43:01 +00:00
|
|
|
}
|
|
|
|
|
2023-10-15 19:29:29 +00:00
|
|
|
func TestCommitlog(ctype string, metadata map[string]string, author string) CommitLog {
|
2021-02-14 02:35:31 +00:00
|
|
|
breaking := false
|
2023-10-15 19:29:29 +00:00
|
|
|
if _, found := metadata[BreakingChangeMetadataKey]; found {
|
2021-02-14 02:35:31 +00:00
|
|
|
breaking = true
|
|
|
|
}
|
2023-10-12 14:18:25 +00:00
|
|
|
|
2023-10-15 19:29:29 +00:00
|
|
|
return CommitLog{
|
2021-02-14 02:35:31 +00:00
|
|
|
Message: CommitMessage{
|
2021-02-15 04:47:20 +00:00
|
|
|
Type: ctype,
|
2021-02-14 02:35:31 +00:00
|
|
|
Description: "subject text",
|
|
|
|
IsBreakingChange: breaking,
|
|
|
|
Metadata: metadata,
|
|
|
|
},
|
2022-02-07 01:06:46 +00:00
|
|
|
AuthorName: author,
|
2019-11-17 17:43:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-15 19:29:29 +00:00
|
|
|
func TestReleaseNote(
|
2023-10-12 14:18:25 +00:00
|
|
|
version *semver.Version,
|
|
|
|
tag string,
|
|
|
|
date time.Time,
|
|
|
|
sections []ReleaseNoteSection,
|
|
|
|
authorsNames map[string]struct{},
|
|
|
|
) ReleaseNote {
|
2019-11-17 17:43:01 +00:00
|
|
|
return ReleaseNote{
|
2022-02-08 01:49:32 +00:00
|
|
|
Version: version,
|
|
|
|
Tag: tag,
|
|
|
|
Date: date.Truncate(time.Minute),
|
|
|
|
Sections: sections,
|
|
|
|
AuthorsNames: authorsNames,
|
2019-11-17 17:43:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-15 19:29:29 +00:00
|
|
|
func TestNewReleaseNoteCommitsSection(name string, types []string, items []CommitLog) ReleaseNoteCommitsSection {
|
2022-02-08 01:49:32 +00:00
|
|
|
return ReleaseNoteCommitsSection{
|
2019-11-17 17:43:01 +00:00
|
|
|
Name: name,
|
2022-02-07 01:06:46 +00:00
|
|
|
Types: types,
|
2019-11-17 17:43:01 +00:00
|
|
|
Items: items,
|
|
|
|
}
|
|
|
|
}
|