Skip to content

Commit

Permalink
Added a test for config checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Elgarni committed Feb 11, 2019
1 parent 7fcc437 commit b78b8fb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions codegen/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ func TestReferencedPackages(t *testing.T) {
})

}

func TestConfigCheck(t *testing.T) {
t.Run("invalid config format due to conflicting package names", func(t *testing.T) {
config, err := LoadConfig("testdata/cfg/conflictedPackages.yml")
require.NoError(t, err)

err = config.normalize()
require.NoError(t, err)

err = config.check()
require.EqualError(t, err, "filenames exec.go and models.go are in the same directory but have different package definitions")
})
}
10 changes: 10 additions & 0 deletions codegen/testdata/cfg/conflictedPackages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
schema:
- schema.graphql
exec:
filename: generated/exec.go
package: graphql
model:
filename: generated/models.go
resolver:
filename: generated/resolver.go
type: Resolver

0 comments on commit b78b8fb

Please sign in to comment.