Move trim command orchestration into internal trim package
This commit is contained in:
28
internal/trim/run_test.go
Normal file
28
internal/trim/run_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package trim
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/seriatim/internal/config"
|
||||
)
|
||||
|
||||
func TestRunReturnsContextErrorBeforeWork(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
err := Run(ctx, config.TrimConfig{
|
||||
InputFile: filepath.Join(dir, "input.json"),
|
||||
OutputFile: filepath.Join(dir, "output.json"),
|
||||
Mode: "keep",
|
||||
Selector: "1",
|
||||
OutputSchema: "",
|
||||
AllowEmpty: false,
|
||||
})
|
||||
if !errors.Is(err, context.Canceled) {
|
||||
t.Fatalf("error = %v, want context.Canceled", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user