set -l repo_path $HOME/github.com/gh_user/gh_repo

function setup -S
  mkdir -p $repo_path
end

function teardown -S
  rm -rf (dirname $repo_path)
end

test "navigates to existing directory when given user repo"
  (
    gh gh_user gh_repo
    pwd
  ) = "$HOME/github.com/gh_user/gh_repo"
end

test "navigates to existing directory when given user/repo"
  (
    gh gh_user/gh_repo
    pwd
  ) = "$HOME/github.com/gh_user/gh_repo"
end

test "navigates to existing directory when given user"
  (
    gh gh_user
    pwd
  ) = "$HOME/github.com/gh_user"
end

set -l repo_path $HOME/github.com/gh_user/gh_repo

function setup -S
  mkdir -p $repo_path
end

function teardown -S
  rm -rf (dirname $repo_path)
end

test "navigates to existing directory when given user repo"
  "$HOME/github.com/gh_user/gh_repo" = (
    gh gh_user gh_repo
    pwd
  )
end

test "navigates to existing directory when given user/repo"
  "$HOME/github.com/gh_user/gh_repo" = (
    gh gh_user/gh_repo
    pwd
  )
end

test "navigates to existing directory when given user"
  "$HOME/github.com/gh_user" = (
    gh gh_user
    pwd
  )
end

Swap expected and actual in tests
Swap expected and actual in tests

Contrary to other testing frameworks, with fishtape you have to put
the expected on the LHS and actual (aka received) on the RHS.

Looking at other fish tests, many fishers still put expected on the RHS,
but this will give you an incorrect and confusing failure message.

dideler/fish-cd-git