forked from sheerun/graphqlviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
39 lines (34 loc) · 1.62 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import test from 'ava';
import fs from 'fs';
import graphqlviz from './';
import path from 'path';
test('render', t => {
var input = fs.readFileSync(path.resolve(__dirname, 'test/input.json')).toString();
var output = fs.readFileSync(path.resolve(__dirname, 'test/output-noargs.dot')).toString();
var computed = graphqlviz.render(input, {noargs: true}) + '\n';
t.same(computed, output);
});
test('render with args', t => {
var input = fs.readFileSync(path.resolve(__dirname, 'test/input.json')).toString();
var output = fs.readFileSync(path.resolve(__dirname, 'test/output.dot')).toString();
var computed = graphqlviz.render(input, {}) + '\n';
t.same(computed, output);
});
test('render with sort', t => {
var input = fs.readFileSync(path.resolve(__dirname, 'test/input.json')).toString();
var output = fs.readFileSync(path.resolve(__dirname, 'test/output-sort.dot')).toString();
var computed = graphqlviz.render(input, {sort: true}) + '\n';
t.same(computed, output);
});
test('render with support for NON_NULL lists', t => {
var input = fs.readFileSync(path.resolve(__dirname, 'test/simple-input.json')).toString();
var output = fs.readFileSync(path.resolve(__dirname, 'test/simple-output.dot')).toString();
var computed = graphqlviz.render(input, {}) + '\n';
t.same(computed, output);
});
test('render with support for NON_NULL lists', t => {
var input = fs.readFileSync(path.resolve(__dirname, 'test/complex-input.json')).toString();
var output = fs.readFileSync(path.resolve(__dirname, 'test/complex-output.dot')).toString();
var computed = graphqlviz.render(input, {}) + '\n';
t.same(computed, output);
});