Skip to content

Commit

Permalink
Make migration submit test consistent w/ unit test
Browse files Browse the repository at this point in the history
Unify the assertions on metadata existing
  • Loading branch information
jdsutherland committed Aug 30, 2018
1 parent 305edf2 commit 5d4e34b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmd/submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,20 @@ func TestLegacySolutionMetadataMigration(t *testing.T) {
Dir: tmpDir,
UserViperConfig: v,
}
_, err = os.Stat(exercise.MetadataFilepath())
assert.Error(t, err)

ok, _ := exercise.HasLegacyMetadata()
assert.True(t, ok)
ok, _ = exercise.HasMetadata()
assert.False(t, ok)

err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), []string{file})
assert.NoError(t, err)
assert.Equal(t, "This is a file.", submittedFiles["file.txt"])

_, err = os.Stat(exercise.MetadataFilepath())
assert.NoError(t, err)
_, err = os.Stat(exercise.LegacyMetadataFilepath())
assert.Error(t, err)
ok, _ = exercise.HasLegacyMetadata()
assert.False(t, ok)
ok, _ = exercise.HasMetadata()
assert.True(t, ok)
}

func TestSubmitWithEmptyFile(t *testing.T) {
Expand Down

0 comments on commit 5d4e34b

Please sign in to comment.