mediamdl_test.go 1.83 KiB
Newer Older
package mediamdl

import (
	"testing"

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

func TestCompressVideo(t *testing.T) {
	inputPath := "../testingdata/mediamdl/video/sample.avi"
	outputPath := "../testingdata/mediamdl/video/sample-compress-video.mp4"
	err := CompressVideo(inputPath, outputPath)
	assert.Error(t, err, "This will thrown an error.")
}

func TestResizeVideo(t *testing.T) {
	inputPath := "../testingdata/mediamdl/video/sample.mp4"
	outputPath := "../testingdata/mediamdl/video/sample-resize-video.mp4"
	err := ResizeVideo(inputPath, "100", "100", outputPath)
	assert.Error(t, err, "This will thrown an error.")
}

func TestGetAudioFromVideo(t *testing.T) {
	inputPath := "../testingdata/mediamdl/audio/sample.mp4"
	outputPath := "../testingdata/mediamdl/audio/sample-audio.mp3"
	err := GetAudioFromVideo(inputPath, outputPath)
	assert.Error(t, err, "This will thrown an error.")
}

func TestCompressImage(t *testing.T) {
	inputPath := "../testingdata/mediamdl/image/sample.bmp"
	outputPath := "../testingdata/mediamdl/image/sample-compress-image.jpg"
	err := CompressImage(inputPath, outputPath)
	assert.Error(t, err, "This will thrown an error.")
}

func TestResizeImage(t *testing.T) {
	inputPath := "../testingdata/mediamdl/image/sample.bmp"
	outputPath := "../testingdata/mediamdl/image/sample-resized-image.bmp"
	err := ResizeImage(inputPath, outputPath, "100")
	assert.Error(t, err, "This will thrown an error.")
}

func TestResizeImageWithoutAspectRatio(t *testing.T) {
	inputPath := "../testingdata/mediamdl/image/sample.bmp"
	outputPath := "../testingdata/mediamdl/image/sample-resize-wo-aspect-image.bmp"
	err := ResizeImageWithoutAspectRatio(inputPath, outputPath, "100", "100")
	assert.Error(t, err, "This will thrown an error.")
}

func TestSmartCropImage(t *testing.T) {
	err := SmartCropImage()
	assert.Error(t, err, "This will not throw error")