@@ -112,6 +112,58 @@ describe('N3Util', function () {
112112 } ) ;
113113 } ) ;
114114
115+ describe ( 'isDefaultGraph' , function ( ) {
116+ it ( 'does not match a blank node' , function ( ) {
117+ N3Util . isDefaultGraph ( '_:x' ) . should . be . false ;
118+ } ) ;
119+
120+ it ( 'does not match an IRI' , function ( ) {
121+ N3Util . isDefaultGraph ( 'http://example.org/' ) . should . be . false ;
122+ } ) ;
123+
124+ it ( 'does not match a literal' , function ( ) {
125+ N3Util . isDefaultGraph ( '"http://example.org/"' ) . should . be . false ;
126+ } ) ;
127+
128+ it ( 'matches null' , function ( ) {
129+ expect ( N3Util . isDefaultGraph ( null ) ) . to . be . true ;
130+ } ) ;
131+
132+ it ( 'matches undefined' , function ( ) {
133+ expect ( N3Util . isDefaultGraph ( undefined ) ) . to . be . true ;
134+ } ) ;
135+
136+ it ( 'matches the empty string' , function ( ) {
137+ expect ( N3Util . isDefaultGraph ( '' ) ) . to . be . true ;
138+ } ) ;
139+ } ) ;
140+
141+ describe ( 'inDefaultGraph' , function ( ) {
142+ it ( 'does not match a blank node' , function ( ) {
143+ N3Util . inDefaultGraph ( { graph : '_:x' } ) . should . be . false ;
144+ } ) ;
145+
146+ it ( 'does not match an IRI' , function ( ) {
147+ N3Util . inDefaultGraph ( { graph : 'http://example.org/' } ) . should . be . false ;
148+ } ) ;
149+
150+ it ( 'does not match a literal' , function ( ) {
151+ N3Util . inDefaultGraph ( { graph : '"http://example.org/"' } ) . should . be . false ;
152+ } ) ;
153+
154+ it ( 'matches null' , function ( ) {
155+ N3Util . inDefaultGraph ( { graph : null } ) . should . be . true ;
156+ } ) ;
157+
158+ it ( 'matches undefined' , function ( ) {
159+ N3Util . inDefaultGraph ( { graph : undefined } ) . should . be . true ;
160+ } ) ;
161+
162+ it ( 'matches the empty string' , function ( ) {
163+ N3Util . inDefaultGraph ( { graph : '' } ) . should . be . true ;
164+ } ) ;
165+ } ) ;
166+
115167 describe ( 'getLiteralValue' , function ( ) {
116168 it ( 'gets the value of a literal' , function ( ) {
117169 N3Util . getLiteralValue ( '"Mickey"' ) . should . equal ( 'Mickey' ) ;
0 commit comments