1- import { gtl } from '../src'
2- import fs from 'fs-extra'
1+ import fs from 'fs'
32import path from 'path'
3+ import { gtl } from '../src'
4+ import { matchProperty } from './../src/utils/matchProperty'
5+ import { fileCheck } from './../src/utils/fileCheck'
6+ import { fileValidator , optionsValidator , propertyValidator } from './../src/utils/validatorCheck'
47
58describe ( 'GTL Testing Group' , function ( ) {
69 beforeAll ( function ( ) {
@@ -15,21 +18,88 @@ describe('GTL Testing Group', function () {
1518
1619 it ( 'Should be gtl read file inside multiple directory success' , function ( ) {
1720 const graphqlLoader = gtl ( { directory : 'src' , pattern : '**/*' , fileName : 'isf.graphql' } )
21+
22+ expect ( graphqlLoader ) . toBeDefined ( )
1823 expect ( graphqlLoader ) . toBeInstanceOf ( Array )
1924 } )
2025
2126 it ( 'Should be gtl read file outside multiple directory success' , function ( ) {
2227 const graphqlLoader = gtl ( { pattern : '**/*' , fileName : 'osf.graphql' } )
28+
29+ expect ( graphqlLoader ) . toBeDefined ( )
2330 expect ( graphqlLoader ) . toBeInstanceOf ( Array )
2431 } )
2532
2633 it ( 'Should be gtl read file inside single directory success' , function ( ) {
2734 const graphqlLoader = gtl ( { directory : 'src' , fileName : 'isf.graphql' } )
35+
36+ expect ( graphqlLoader ) . toBeDefined ( )
2837 expect ( graphqlLoader ) . toBeInstanceOf ( Array )
2938 } )
3039
3140 it ( 'Should be gtl read file outside directory success' , function ( ) {
3241 const graphqlLoader = gtl ( { fileName : 'osf.graphql' } )
42+
43+ expect ( graphqlLoader ) . toBeDefined ( )
44+ expect ( graphqlLoader ) . toBeInstanceOf ( Array )
45+ } )
46+
47+ it ( 'Should be gtl matchProperty success' , function ( ) {
48+ const defaultProperty = { directory : null , pattern : null , fileName : null , extension : null }
49+ const graphqlLoader = matchProperty ( defaultProperty , { directory : null , pattern : null , fileName : null , extension : null } )
50+
51+ expect ( graphqlLoader ) . toBeDefined ( )
52+ expect ( graphqlLoader ) . toBeTruthy ( )
53+ } )
54+
55+ it ( 'Should be gtl matchProperty error' , function ( ) {
56+ const defaultProperty = { directory : null , pattern : null , fileName : null , extension : null }
57+ const graphqlLoader = matchProperty ( defaultProperty , { directoryx : null , patternx : null , fileNamex : null , extensionx : null } )
58+
59+ expect ( graphqlLoader ) . toBeDefined ( )
60+ expect ( graphqlLoader ) . toBeFalsy ( )
61+ } )
62+
63+ it ( 'Should be gtl fileCheck success' , function ( ) {
64+ const gtlPRoperty = { directory : 'src' , fileName : 'isf.graphql' }
65+ const graphqlLoader = fileCheck ( gtlPRoperty )
66+
67+ expect ( graphqlLoader ) . toBeDefined ( )
3368 expect ( graphqlLoader ) . toBeInstanceOf ( Array )
3469 } )
70+
71+ it ( 'Should be gtl fileValidator success' , function ( ) {
72+ const graphqlLoader = fileValidator ( { extension : 'graphql' } )
73+
74+ expect ( graphqlLoader ) . toBeDefined ( )
75+ expect ( graphqlLoader ) . toBeTruthy ( )
76+ } )
77+
78+ it ( 'Should be gtl fileValidator error' , function ( ) {
79+ const graphqlLoader = fileValidator ( { extension : 'ts' } )
80+
81+ expect ( graphqlLoader ) . toBeDefined ( )
82+ expect ( graphqlLoader ) . toBeInstanceOf ( Promise )
83+ } )
84+
85+ it ( 'Should be gtl optionsValidator success' , function ( ) {
86+ const graphqlLoader = optionsValidator ( { directory : 'src' , pattern : '**/*' , fileName : 'isf.graphql' } )
87+
88+ expect ( graphqlLoader ) . toBeDefined ( )
89+ expect ( graphqlLoader ) . toBeTruthy ( )
90+ } )
91+
92+ it ( 'Should be gtl optionsValidator error' , function ( ) {
93+ const graphqlLoader = optionsValidator ( { directoryx : 'src' , patternx : '**/*' , fileNamex : 'isf.graphql' } )
94+
95+ expect ( graphqlLoader ) . toBeDefined ( )
96+ expect ( graphqlLoader ) . toBeInstanceOf ( Promise )
97+ } )
98+
99+ it ( 'Should be gtl propertyValidator success' , function ( ) {
100+ const graphqlLoader = propertyValidator ( { directory : 'src' , pattern : '**/*' , fileName : 'isf.graphql' } )
101+
102+ expect ( graphqlLoader ) . toBeDefined ( )
103+ expect ( graphqlLoader ) . toBeTruthy ( )
104+ } )
35105} )
0 commit comments