1- const chai = require ( 'chai' ) ;
2- const expect = chai . expect ;
1+ const chai = require ( 'chai' )
2+ const expect = chai . expect
33
44const fundamentalObjects = [
55 Function ,
@@ -10,53 +10,62 @@ const fundamentalObjects = [
1010 String ,
1111 RegExp ,
1212 Array
13- ] ;
13+ ]
1414
1515// Save the current value of toString() for each object, before the import of Opal
1616const fundamentalToStringValues = [ ]
1717for ( let index in fundamentalObjects ) {
18- const fundamentalObject = fundamentalObjects [ index ] ;
19- fundamentalToStringValues . push ( fundamentalObject . toString ( ) ) ;
18+ const fundamentalObject = fundamentalObjects [ index ]
19+ fundamentalToStringValues . push ( fundamentalObject . toString ( ) )
2020}
2121
22- const Opal = require ( '../src/index' ) . Opal ;
22+ const Opal = require ( '../src/index' ) . Opal
2323
2424describe ( 'Opal Node Runtime' , function ( ) {
2525
26- describe ( 'When loaded' , function ( ) {
27- it ( 'should export Opal object' , function ( ) {
28- expect ( Opal ) . not . be . null ;
29- } ) ;
26+ describe ( 'When loaded' , function ( ) {
27+ it ( 'should export Opal object' , function ( ) {
28+ expect ( Opal ) . not . be . null
29+ } )
3030
31- it ( 'should preserve Function methods' , function ( ) {
31+ it ( 'should preserve Function methods' , function ( ) {
3232
3333 for ( let index in fundamentalObjects ) {
34- const fundamentalObject = fundamentalObjects [ index ] ;
35- expect ( fundamentalObject . call , `${ fundamentalObject . name } .call should be a Function` ) . to . be . an . instanceof ( Function ) ;
36- expect ( fundamentalObject . apply , `${ fundamentalObject . name } .apply should be a Function` ) . to . be . an . instanceof ( Function ) ;
37- expect ( fundamentalObject . bind , `${ fundamentalObject . name } .bind should be a Function` ) . to . be . an . instanceof ( Function ) ;
38- expect ( fundamentalObject . toString ( ) , `${ fundamentalObject . name } .toString should be native function` ) . to . be . equal ( fundamentalToStringValues [ index ] ) ;
39- expect ( fundamentalObject . toString ( ) ) . to . equal ( `function ${ fundamentalObject . name } () { [native code] }` ) ;
34+ const fundamentalObject = fundamentalObjects [ index ]
35+ expect ( fundamentalObject . call , `${ fundamentalObject . name } .call should be a Function` ) . to . be . an . instanceof ( Function )
36+ expect ( fundamentalObject . apply , `${ fundamentalObject . name } .apply should be a Function` ) . to . be . an . instanceof ( Function )
37+ expect ( fundamentalObject . bind , `${ fundamentalObject . name } .bind should be a Function` ) . to . be . an . instanceof ( Function )
38+ expect ( fundamentalObject . toString ( ) , `${ fundamentalObject . name } .toString should be native function` ) . to . be . equal ( fundamentalToStringValues [ index ] )
39+ expect ( fundamentalObject . toString ( ) ) . to . equal ( `function ${ fundamentalObject . name } () { [native code] }` )
4040 }
41- } ) ;
42- } ) ;
43-
44- describe ( 'When pathname module is loaded' , function ( ) {
45- it ( 'should register Pathname methods' , function ( ) {
46- Opal . load ( 'pathname' ) ;
47- var Pathname = Opal . const_get_relative ( [ ] , 'Pathname' ) ;
48- var path1 = Pathname . $new ( '/foo/bar' ) ;
49- var path2 = Pathname . $new ( 'qux' ) ;
50- expect ( path1 [ '$+' ] ( path2 ) [ '$to_path' ] ( ) ) . to . equal ( '/foo/bar/qux' ) ;
51- } ) ;
52- } ) ;
53-
54- describe ( 'When nodejs module is loaded' , function ( ) {
55- it ( 'should register Node.js specific implementations' , function ( ) {
56- Opal . load ( 'nodejs' ) ;
57- var Dir = Opal . const_get_relative ( [ ] , 'Dir' ) ;
58- var currentDir = Dir [ '$pwd' ] ( ) ;
59- expect ( currentDir ) . to . equal ( process . cwd ( ) ) ;
60- } ) ;
61- } ) ;
62- } ) ;
41+ } )
42+ } )
43+
44+ describe ( 'When pathname module is loaded' , function ( ) {
45+ it ( 'should register Pathname methods' , function ( ) {
46+ Opal . load ( 'pathname' )
47+ var Pathname = Opal . const_get_relative ( [ ] , 'Pathname' )
48+ var path1 = Pathname . $new ( '/foo/bar' )
49+ var path2 = Pathname . $new ( 'qux' )
50+ expect ( path1 [ '$+' ] ( path2 ) [ '$to_path' ] ( ) ) . to . equal ( '/foo/bar/qux' )
51+ } )
52+ } )
53+
54+ describe ( 'When nodejs module is loaded' , function ( ) {
55+ it ( 'should register Node.js specific implementations' , function ( ) {
56+ Opal . load ( 'nodejs' )
57+ var Dir = Opal . const_get_relative ( [ ] , 'Dir' )
58+ var currentDir = Dir [ '$pwd' ] ( )
59+ expect ( currentDir ) . to . equal ( process . cwd ( ) )
60+ } )
61+ } )
62+
63+ describe ( 'When nodejs module is loaded' , function ( ) {
64+ it ( 'should register Node.js specific implementations' , function ( ) {
65+ Opal . load ( 'nodejs' )
66+ var Dir = Opal . const_get_relative ( [ ] , 'Dir' )
67+ var currentDir = Dir [ '$pwd' ] ( )
68+ expect ( currentDir ) . to . equal ( process . cwd ( ) )
69+ } )
70+ } )
71+ } )
0 commit comments