package solutions.tretter.githugandroid

import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test

class EditorCommandsTest {
    @Test
    fun parsesSupportedVisualEditorCommandWithPath() {
        val invocation = parseVisualEditorInvocation("vi .gitignore")

        assertEquals("vi", invocation?.editor)
        assertEquals(".gitignore", invocation?.path)
        assertEquals("vi .gitignore", invocation?.command)
    }

    @Test
    fun ignoresEditorOptionsWhenChoosingPath() {
        val invocation = parseVisualEditorInvocation("nano -w README")

        assertEquals("nano", invocation?.editor)
        assertEquals("README", invocation?.path)
    }

    @Test
    fun ignoresNonEditorCommands() {
        assertNull(parseVisualEditorInvocation("git status"))
    }
}
