Skip to content

Commit

Permalink
Merge pull request #63 from stripe/brandur-fix-non-deterministic-tset
Browse files Browse the repository at this point in the history
Fix non-deterministic test
  • Loading branch information
brandur-stripe authored Apr 16, 2018
2 parents 65e92ad + 21f69bd commit 564badc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,11 @@ func propertyNames(schema *spec.Schema) string {
for name := range schema.Properties {
names = append(names, name)
}

// Sort just so we can have stable output to test against (the order at
// which keys will be iterated in the map is undefined).
sort.Strings(names)

return strings.Join(names, ", ")
}

Expand Down
2 changes: 1 addition & 1 deletion generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func TestGenerateSyntheticFixture(t *testing.T) {
}

func TestPropertyNames(t *testing.T) {
assert.Equal(t, "foo, bar", propertyNames(&spec.Schema{
assert.Equal(t, "bar, foo", propertyNames(&spec.Schema{
Properties: map[string]*spec.Schema{
"foo": nil,
"bar": nil,
Expand Down

0 comments on commit 564badc

Please sign in to comment.