Skip to content

Commit

Permalink
validation: OverlappingFieldsCanBeMerged
Browse files Browse the repository at this point in the history
  • Loading branch information
neelance committed May 31, 2017
1 parent e7ca4fd commit 7775096
Show file tree
Hide file tree
Showing 4 changed files with 568 additions and 10 deletions.
10 changes: 10 additions & 0 deletions internal/tests/all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"reflect"
"sort"
"testing"

"encoding/json"
Expand Down Expand Up @@ -56,9 +57,18 @@ func TestAll(t *testing.T) {
got = append(got, err)
}
}
sortLocations(test.Errors)
sortLocations(got)
if !reflect.DeepEqual(test.Errors, got) {
t.Errorf("wrong errors\nexpected: %v\ngot: %v", test.Errors, got)
}
})
}
}

func sortLocations(errs []*errors.QueryError) {
for _, err := range errs {
locs := err.Locations
sort.Slice(locs, func(i, j int) bool { return locs[i].Before(locs[j]) })
}
}
8 changes: 7 additions & 1 deletion internal/tests/testdata/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ let fakeModules = {
errors: [],
});
},
expectPassesRuleWithSchema(schema, rule, queryString, errors) {
// ignored
},
expectFailsRule(rule, queryString, errors) {
tests.push({
name: names.join('/'),
Expand All @@ -46,6 +49,9 @@ let fakeModules = {
errors: errors,
});
},
expectFailsRuleWithSchema(schema, rule, queryString, errors) {
// ignored
}
},
};

Expand All @@ -67,7 +73,7 @@ require('./src/validation/__tests__/NoFragmentCycles-test');
require('./src/validation/__tests__/NoUndefinedVariables-test');
require('./src/validation/__tests__/NoUnusedFragments-test');
require('./src/validation/__tests__/NoUnusedVariables-test');
// require('./src/validation/__tests__/OverlappingFieldsCanBeMerged-test');
require('./src/validation/__tests__/OverlappingFieldsCanBeMerged-test');
require('./src/validation/__tests__/PossibleFragmentSpreads-test');
require('./src/validation/__tests__/ProvidedNonNullArguments-test');
require('./src/validation/__tests__/ScalarLeafs-test');
Expand Down
Loading

0 comments on commit 7775096

Please sign in to comment.