1111// See the License for the specific language governing permissions and
1212// limitations under the License.
1313
14- import JSBI from '../jsbi' ;
15- import { assertEqual , assertTrue } from './assert' ;
14+ /* eslint-disable max-len */
15+ import JSBI from '../dist/jsbi.mjs' ;
16+ import { assertEqual , assertTrue } from './assert.mjs' ;
1617
1718{
1819 // Test the example from the README.
@@ -51,7 +52,7 @@ import { assertEqual, assertTrue } from './assert';
5152 // Emulate an environment that doesn't have Symbol (e.g. IE11)
5253 // and make sure we can still coerce to primitive values.
5354 // See #74.
54- const globalSymbol = globalThis . Symbol ;
55+ const globalSymbol = globalThis . Symbol ;
5556 try {
5657 globalThis . Symbol = undefined ;
5758 assertTrue ( JSBI . EQ ( JSBI . BigInt ( 0x7FFFFFFF ) , {
@@ -104,7 +105,7 @@ const TESTS = [
104105 b : '-0b1111111111111111111111111111111111111111111111111111111111111111' ,
105106 expected : '-0b1111111111111111111111111111111111111111111111111111111111111111' ,
106107 } ,
107- { // https://github.com/GoogleChromeLabs/jsbi/issues/57
108+ { // https://github.com/GoogleChromeLabs/jsbi/issues/57
108109 operation : 'signedRightShift' ,
109110 a : '-0xFFFFFFFFFFFFFFFF' ,
110111 b : '32' ,
@@ -116,15 +117,15 @@ const TESTS = [
116117( function ( ) {
117118 const VALID = [ '123' , ' 123 ' , ' 123 ' ] ;
118119 const INVALID = [ 'x123' , 'x 123' , ' 123x' , '123 x' , '123 xx' , '123 ?a' ,
119- '-0o0' , '-0x0' , '-0b0' , '-0x1' ] ;
120+ '-0o0' , '-0x0' , '-0b0' , '-0x1' ] ;
120121 for ( const v of VALID ) {
121122 const result = JSBI . BigInt ( v ) ;
122123 assertTrue ( JSBI . equal ( result , JSBI . BigInt ( 123 ) ) ) ;
123124 }
124125 for ( const i of INVALID ) {
125126 try {
126127 const result = JSBI . BigInt ( i ) ;
127- throw " unreachable" ;
128+ throw ' unreachable' ;
128129 } catch ( exception ) {
129130 assertTrue ( exception instanceof SyntaxError ) ;
130131 }
@@ -135,7 +136,9 @@ const TESTS = [
135136( function ( ) {
136137 const o = {
137138 num : 123 ,
138- [ Symbol . toPrimitive ] : function ( ) { return this . num ; }
139+ [ Symbol . toPrimitive ] : function ( ) {
140+ return this . num ;
141+ } ,
139142 } ;
140143 const result = JSBI . BigInt ( o ) ;
141144 assertTrue ( JSBI . equal ( result , JSBI . BigInt ( 123 ) ) ) ;
@@ -162,12 +165,12 @@ for (const test of TESTS) {
162165 const expected = parse ( test . expected ) ;
163166 const result = JSBI [ operation ] ( a , b ) ;
164167 assertTrue (
165- JSBI . equal ( result , expected ) ,
166- `
168+ JSBI . equal ( result , expected ) ,
169+ `
167170 Unexpected result.
168171 ${ hex ( a ) } ${ operation } ${ hex ( b ) }
169172 Expected: ${ hex ( expected ) }
170173 Actual: ${ hex ( result ) }
171- ` . trim ( ) . replace ( / \t / g, '' )
174+ ` . trim ( ) . replace ( / \t / g, '' ) ,
172175 ) ;
173176}
0 commit comments