// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-package main
+package frontend
import (
"io/fs"
"testing"
"ruderich.org/simon/safcm"
- "ruderich.org/simon/safcm/cmd/safcm/config"
"ruderich.org/simon/safcm/testutil"
)
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- s := &Sync{
- config: &config.Config{
- DryRun: tc.dryRun,
- Quiet: tc.quiet,
- },
- isTTY: tc.isTTY,
+ c := Changes{
+ DryRun: tc.dryRun,
+ Quiet: tc.quiet,
+ IsTTY: tc.isTTY,
}
- res := s.formatChanges(tc.resp)
+ res := c.FormatChanges(tc.resp)
testutil.AssertEqual(t, "res", res, tc.exp)
})
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- s := &Sync{
- config: &config.Config{
- DryRun: tc.dryRun,
- },
- isTTY: tc.isTTY,
+ c := Changes{
+ DryRun: tc.dryRun,
+ IsTTY: tc.isTTY,
}
- res := s.formatFileChanges(tc.changes)
+ res := c.FormatFileChanges(tc.changes)
testutil.AssertEqual(t, "res", res, tc.exp)
})
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- s := &Sync{
- config: &config.Config{
- DryRun: tc.dryRun,
- },
- isTTY: tc.isTTY,
+ c := Changes{
+ DryRun: tc.dryRun,
+ IsTTY: tc.isTTY,
}
- res := s.formatPackageChanges(tc.changes)
+ res := c.FormatPackageChanges(tc.changes)
testutil.AssertEqual(t, "res", res, tc.exp)
})
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- s := &Sync{
- config: &config.Config{
- DryRun: tc.dryRun,
- },
- isTTY: tc.isTTY,
+ c := Changes{
+ DryRun: tc.dryRun,
+ IsTTY: tc.isTTY,
}
- res := s.formatServiceChanges(tc.changes)
+ res := c.FormatServiceChanges(tc.changes)
testutil.AssertEqual(t, "res", res, tc.exp)
})
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- s := &Sync{
- config: &config.Config{
- DryRun: tc.dryRun,
- Quiet: tc.quiet,
- },
- isTTY: tc.isTTY,
+ c := Changes{
+ DryRun: tc.dryRun,
+ Quiet: tc.quiet,
+ IsTTY: tc.isTTY,
}
- res := s.formatCommandChanges(tc.changes)
+ res := c.FormatCommandChanges(tc.changes)
testutil.AssertEqual(t, "res", res, tc.exp)
})
}