Skip to content

Commit

Permalink
Test new command
Browse files Browse the repository at this point in the history
  • Loading branch information
zix99 committed Dec 14, 2024
1 parent e9c5edc commit a7d4aa8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cmd/spark_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestSparkline(t *testing.T) {
testCommandSet(t, sparkCommand(),
`-m "(.+) (\d+)" -e "{$ {1} {2}}" testdata/graph.txt`,
`-o - -m "(.+) (\d+)" -e "{$ {1} {2}}" testdata/graph.txt`,
)
}

func TestSparklineWithTrim(t *testing.T) {
out, eout, err := testCommandCapture(sparkCommand(), `--snapshot -m "(.+) (.+)" -e {1} -e {2} --cols 2 testdata/heat.txt`)

assert.NoError(t, err)
assert.Empty(t, eout)
assert.Contains(t, out, " First bc Last \ny 1 _█ 2 \nx 1 __ 1 \nMatched: 10 / 10 (R: 2; C: 2)")
}

0 comments on commit a7d4aa8

Please sign in to comment.