1- const colorGradient = require ( "./index" ) ;
1+ const Gradient = require ( "./index" ) ;
22const expect = require ( "chai" ) . expect ;
33
44describe ( "javascript-color-gradient" , function ( ) {
55 describe ( "getArray" , function ( ) {
66 it ( "should return an array of strings" , function ( ) {
7- expect ( colorGradient . getArray ) . to . satisfy ( isArrayOfStrings ) ;
7+ expect (
8+ new Gradient ( ) . setColorGradient ( "#3F2CAF" , "#8BC2E3" ) . getColors ( )
9+ ) . to . satisfy ( isArrayOfStrings ) ;
810
911 function isArrayOfStrings ( ) {
1012 return function ( item ) {
@@ -14,9 +16,9 @@ describe("javascript-color-gradient", function () {
1416 } ) ;
1517 } ) ;
1618
17- describe ( "setGradient " , function ( ) {
19+ describe ( "setColorGradient " , function ( ) {
1820 it ( "type should be an object" , function ( ) {
19- expect ( colorGradient . setGradient ( "#3F2CAF" , "#8BC2E3" ) ) . to . satisfy (
21+ expect ( new Gradient ( ) . setColorGradient ( "#3F2CAF" , "#8BC2E3" ) ) . to . satisfy (
2022 isObject
2123 ) ;
2224
@@ -26,9 +28,13 @@ describe("javascript-color-gradient", function () {
2628 } ) ;
2729 } ) ;
2830
29- describe ( "getArray " , function ( ) {
31+ describe ( "getColors " , function ( ) {
3032 it ( "array length should be 10" , function ( ) {
31- expect ( colorGradient . getArray ( "#3F2CAF" , "#8BC2E3" ) ) . to . satisfy ( isArray ) ;
33+ expect (
34+ new Gradient ( )
35+ . setColorGradient ( "#3F2CAF" , "e9446a" )
36+ . getColors ( "#3F2CAF" , "#8BC2E3" )
37+ ) . to . satisfy ( isArray ) ;
3238
3339 function isArray ( object ) {
3440 return object . length === 10 ;
@@ -38,10 +44,15 @@ describe("javascript-color-gradient", function () {
3844
3945 describe ( "getColor" , function ( ) {
4046 it ( "should be equal to #8bc2e3" , function ( ) {
41- expect ( colorGradient . getColor ( 10 ) ) . to . satisfy ( isEqual ) ;
47+ expect (
48+ new Gradient ( )
49+ . setColorGradient ( "#3F2CAF" , "e9446a" )
50+ . setMidpoint ( 20 )
51+ . getColor ( 2 )
52+ ) . to . satisfy ( isEqual ) ;
4253
4354 function isEqual ( item ) {
44- return item === "#8bc2e3 " ;
55+ return item === "#5930a5 " ;
4556 }
4657 } ) ;
4758 } ) ;
0 commit comments