Files
akvorado/cmd/version_test.go
Vincent Bernat 8be1bca4fd license: AGPL-3.0-only
```
git ls-files \*.js \*.go \
  | xargs sed -i '1i // SPDX-FileCopyrightText: 2022 Free Mobile\n// SPDX-License-Identifier: AGPL-3.0-only\n'
git ls-files \*.vue \
  | xargs sed -i '1i <!-- SPDX-FileCopyrightText: 2022 Free Mobile -->\n<!-- SPDX-License-Identifier: AGPL-3.0-only -->\n'
```
2022-06-29 11:42:28 +02:00

37 lines
700 B
Go

// SPDX-FileCopyrightText: 2022 Free Mobile
// SPDX-License-Identifier: AGPL-3.0-only
package cmd_test
import (
"bytes"
"fmt"
"runtime"
"strings"
"testing"
"akvorado/cmd"
"akvorado/common/helpers"
)
func TestVersion(t *testing.T) {
root := cmd.RootCmd
buf := new(bytes.Buffer)
root.SetOut(buf)
root.SetArgs([]string{"version"})
err := root.Execute()
if err != nil {
t.Errorf("`version` error:\n%+v", err)
}
want := []string{
"akvorado dev",
" Build date: unknown",
fmt.Sprintf(" Built with: %s", runtime.Version()),
"",
}
got := strings.Split(buf.String(), "\n")
if diff := helpers.Diff(got, want); diff != "" {
t.Errorf("`version` (-got, +want):\n%s", diff)
}
}