2018-08-16 06:22:20 +00:00
|
|
|
// Statup
|
|
|
|
// Copyright (C) 2018. Hunter Long and the project contributors
|
|
|
|
// Written by Hunter Long <info@socialeck.com> and the project contributors
|
|
|
|
//
|
|
|
|
// https://github.com/hunterlong/statup
|
|
|
|
//
|
|
|
|
// The licenses for most software and other practical works are designed
|
|
|
|
// to take away your freedom to share and change the works. By contrast,
|
|
|
|
// the GNU General Public License is intended to guarantee your freedom to
|
|
|
|
// share and change all versions of a program--to make sure it remains free
|
|
|
|
// software for all its users.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-08-16 01:07:02 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/rendon/testcli"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2018-08-16 06:22:20 +00:00
|
|
|
func TestConfirmVersion(t *testing.T) {
|
|
|
|
t.SkipNow()
|
|
|
|
assert.NotEmpty(t, VERSION)
|
|
|
|
}
|
|
|
|
|
2018-08-16 01:07:02 +00:00
|
|
|
func TestVersionCommand(t *testing.T) {
|
|
|
|
c := testcli.Command("statup", "version")
|
|
|
|
c.Run()
|
|
|
|
assert.True(t, c.StdoutContains("Statup v"+VERSION))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestHelpCommand(t *testing.T) {
|
|
|
|
c := testcli.Command("statup", "help")
|
|
|
|
c.Run()
|
|
|
|
t.Log(c.Stdout())
|
|
|
|
assert.True(t, c.StdoutContains("statup help - Shows the user basic information about Statup"))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestExportCommand(t *testing.T) {
|
|
|
|
t.SkipNow()
|
|
|
|
c := testcli.Command("statup", "export")
|
|
|
|
c.Run()
|
|
|
|
t.Log(c.Stdout())
|
|
|
|
assert.True(t, c.StdoutContains("Exporting Static 'index.html' page"))
|
|
|
|
assert.True(t, fileExists(dir+"/cmd/index.html"))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAssetsCommand(t *testing.T) {
|
|
|
|
c := testcli.Command("statup", "assets")
|
|
|
|
c.Run()
|
|
|
|
t.Log(c.Stdout())
|
|
|
|
t.Log("Directory for Assets: ", dir)
|
|
|
|
assert.FileExists(t, dir+"/assets/robots.txt")
|
|
|
|
assert.FileExists(t, dir+"/assets/js/main.js")
|
|
|
|
assert.FileExists(t, dir+"/assets/scss/base.scss")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestVersionCLI(t *testing.T) {
|
|
|
|
run := CatchCLI([]string{"statup", "version"})
|
2018-08-16 06:22:20 +00:00
|
|
|
assert.EqualError(t, run, "end")
|
2018-08-16 01:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestAssetsCLI(t *testing.T) {
|
2018-08-17 15:03:46 +00:00
|
|
|
t.SkipNow()
|
2018-08-16 01:07:02 +00:00
|
|
|
run := CatchCLI([]string{"statup", "assets"})
|
2018-08-16 06:22:20 +00:00
|
|
|
assert.EqualError(t, run, "end")
|
2018-08-16 01:15:14 +00:00
|
|
|
assert.FileExists(t, dir+"/assets/css/base.css")
|
|
|
|
assert.FileExists(t, dir+"/assets/scss/base.scss")
|
2018-08-16 01:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestSassCLI(t *testing.T) {
|
|
|
|
run := CatchCLI([]string{"statup", "sass"})
|
2018-08-16 06:22:20 +00:00
|
|
|
assert.EqualError(t, run, "end")
|
2018-08-16 01:15:14 +00:00
|
|
|
assert.FileExists(t, dir+"/assets/css/base.css")
|
2018-08-16 01:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestUpdateCLI(t *testing.T) {
|
2018-08-16 07:19:41 +00:00
|
|
|
t.SkipNow()
|
2018-08-16 01:07:02 +00:00
|
|
|
run := CatchCLI([]string{"statup", "update"})
|
2018-08-16 06:22:20 +00:00
|
|
|
assert.EqualError(t, run, "end")
|
2018-08-16 01:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestTestPackageCLI(t *testing.T) {
|
|
|
|
run := CatchCLI([]string{"statup", "test", "plugins"})
|
2018-08-16 06:22:20 +00:00
|
|
|
assert.EqualError(t, run, "end")
|
2018-08-16 01:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestHelpCLI(t *testing.T) {
|
|
|
|
run := CatchCLI([]string{"statup", "help"})
|
2018-08-16 06:22:20 +00:00
|
|
|
assert.EqualError(t, run, "end")
|
2018-08-16 01:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestRunOnceCLI(t *testing.T) {
|
|
|
|
t.SkipNow()
|
|
|
|
run := CatchCLI([]string{"statup", "run"})
|
|
|
|
assert.Nil(t, run)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestEnvCLI(t *testing.T) {
|
|
|
|
run := CatchCLI([]string{"statup", "env"})
|
|
|
|
assert.Error(t, run)
|
|
|
|
}
|