@@ -2,8 +2,6 @@ open Jest
22open Expect
33open ! Expect .Operators
44
5- open Belt
6-
75describe ("making tinycolor" , () => {
86 test ("fromString() returns valid from string" , () => {
97 let black = TinyColor .makeFromString ("black" )
@@ -435,11 +433,11 @@ describe("color modification tests", () => {
435433
436434describe ("color combinations" , () => {
437435 let mapAndReturnHexArray = (color , fn ) =>
438- Option .map (color , fn )-> Option .getWithDefault ([])-> Array .map (TinyColor .toHexString )
436+ Option .map (color , fn )-> Option .getOr ([])-> Belt . Array .map (TinyColor .toHexString )
439437
440438 test ("analogous()" , () =>
441439 TinyColor .makeFromString ("#f00" )
442- -> Option .getExn
440+ -> Option .getOrThrow
443441 -> TinyColor .analogous ()
444442 -> Array .map (TinyColor .toHexString )
445443 -> expect
@@ -448,7 +446,7 @@ describe("color combinations", () => {
448446
449447 test ("monochromatic()" , () =>
450448 TinyColor .makeFromString ("#f00" )
451- -> Option .getExn
449+ -> Option .getOrThrow
452450 -> TinyColor .monochromatic ()
453451 -> Array .map (TinyColor .toHexString )
454452 -> expect
@@ -475,7 +473,7 @@ describe("color combinations", () => {
475473
476474 test ("polyad()" , () =>
477475 TinyColor .makeFromString ("#f00" )
478- -> Option .getExn
476+ -> Option .getOrThrow
479477 -> TinyColor .polyad (~n = 4 , ())
480478 -> Array .map (TinyColor .toHexString )
481479 -> expect
@@ -496,14 +494,14 @@ describe("color utils", () => {
496494 let a = TinyColor .makeFromString ("red" )
497495 let b = TinyColor .makeFromRgb ({r : 255 , g : 0 , b : 0 })
498496
499- expect (Option .eq (a , b , TinyColor .equals )) === true
497+ expect (Option .equal (a , b , TinyColor .equals )) === true
500498 })
501499
502500 test ("equals() returns false for unequal colors" , () => {
503501 let a = TinyColor .makeFromString ("red" )
504502 let b = TinyColor .makeFromString ("blue" )
505503
506- expect (Option .eq (a , b , TinyColor .equals )) === false
504+ expect (Option .equal (a , b , TinyColor .equals )) === false
507505 })
508506
509507 test ("random()" , () => {
@@ -521,31 +519,31 @@ describe("color utils", () => {
521519
522520 test ("randomMultiple() returns empty array for count=0" , () => {
523521 let a = TinyColor .randomMultiple (~count = 0 , ())
524- expect (Array .length (a ))-> toBe (0 )
522+ expect (Belt . Array .length (a ))-> toBe (0 )
525523 })
526524
527525 test ("randomMultiple() returns single element in array" , () => {
528526 let a = TinyColor .randomMultiple (~count = 1 , ())
529527
530- expect (Array .length (a ))-> toBe (1 )
528+ expect (Belt . Array .length (a ))-> toBe (1 )
531529 })
532530
533531 test ("randomMultiple() returns many elements" , () => {
534532 let a = TinyColor .randomMultiple (~count = 15 , ())
535533
536- expect (Array .length (a ))-> toBe (15 )
534+ expect (Belt . Array .length (a ))-> toBe (15 )
537535 })
538536
539537 test ("randomMultiple() returns all different colors" , () => {
540538 let a = TinyColor .randomMultiple (~count = 4 , ())
541539
542540 expect (
543- ! TinyColor .equals (Array .getExn (a , 0 ), Array .getExn (a , 1 )) &&
544- (! TinyColor .equals (Array .getExn (a , 0 ), Array .getExn (a , 2 )) &&
545- (! TinyColor .equals (Array .getExn (a , 0 ), Array .getExn (a , 3 )) &&
546- (! TinyColor .equals (Array .getExn (a , 1 ), Array .getExn (a , 2 )) &&
547- (! TinyColor .equals (Array .getExn (a , 1 ), Array .getExn (a , 3 )) &&
548- ! TinyColor .equals (Array .getExn (a , 2 ), Array .getExn (a , 3 )))))),
541+ ! TinyColor .equals (Belt . Array .getExn (a , 0 ), Belt . Array .getExn (a , 1 )) &&
542+ (! TinyColor .equals (Belt . Array .getExn (a , 0 ), Belt . Array .getExn (a , 2 )) &&
543+ (! TinyColor .equals (Belt . Array .getExn (a , 0 ), Belt . Array .getExn (a , 3 )) &&
544+ (! TinyColor .equals (Belt . Array .getExn (a , 1 ), Belt . Array .getExn (a , 2 )) &&
545+ (! TinyColor .equals (Belt . Array .getExn (a , 1 ), Belt . Array .getExn (a , 3 )) &&
546+ ! TinyColor .equals (Belt . Array .getExn (a , 2 ), Belt . Array .getExn (a , 3 )))))),
549547 ) === true
550548 })
551549
0 commit comments