-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fsi unlink): unlink command removes .qri-ref file
added some basic tests to make sure this works as expected
- Loading branch information
Showing
5 changed files
with
94 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
func TestFSILinkingCommands(t *testing.T) { | ||
runner := NewFSITestRunner(t, "fsi_commands") | ||
defer runner.Delete() | ||
|
||
pwd := runner.CreateAndChdirToWorkDir("save_and_unlink") | ||
|
||
// Init as a linked directory | ||
if err := runner.ExecCommand("qri init --name save_and_unlink --format csv"); err != nil { | ||
t.Fatal(err.Error()) | ||
} | ||
|
||
// TODO (b5) - get output of qri list, confirm dataset is linked | ||
|
||
// Save a version of the dataset | ||
if err := runner.ExecCommand("qri save"); err != nil { | ||
t.Fatal(err.Error()) | ||
} | ||
|
||
// Verify the directory contains the files that we expect, including .qri-ref link file | ||
dirContents := listDirectory(pwd) | ||
expectContents := []string{".qri-ref", "body.csv", "meta.json", "schema.json"} | ||
if diff := cmp.Diff(dirContents, expectContents); diff != "" { | ||
t.Errorf("directory contents (-want +got):\n%s", diff) | ||
} | ||
|
||
// Unlink the dataset | ||
if err := runner.ExecCommand("qri fsi unlink me/save_and_unlink"); err != nil { | ||
t.Errorf("unlinking dataset: %s", err.Error()) | ||
} | ||
|
||
// Verify the directory contains the files that we expect | ||
dirContents = listDirectory(pwd) | ||
expectContents = []string{"body.csv", "meta.json", "schema.json"} | ||
if diff := cmp.Diff(dirContents, expectContents); diff != "" { | ||
t.Errorf("directory contents after unlinking (-want +got):\n%s", diff) | ||
} | ||
|
||
// TODO (b5) - get output of qri list, confirm dataset is unlinked | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters