@@ -415,7 +415,7 @@ describe("WaveformData", function() {
415
415
} ) ;
416
416
417
417
describe ( ".resample()" , function ( ) {
418
- it ( "should throw an error if attempting to resample to a width larger than the waveform length" , function ( ) {
418
+ it ( "should throw an error if the given width is larger than the waveform length" , function ( ) {
419
419
expect ( function ( ) {
420
420
instance . resample ( { width : 11 } ) ;
421
421
} ) . to . throw ( Error ) ;
@@ -455,12 +455,12 @@ describe("WaveformData", function() {
455
455
456
456
// if we double the scale, it should fit in half the previous size (which means 5px)
457
457
describe ( "full resample by scale" , function ( ) {
458
- it ( "should downsize the number of data by 2 if we request a half-size scaled resampled waveform " , function ( ) {
458
+ it ( "should return a waveform with half the number of points " , function ( ) {
459
459
expect ( instance . resample ( { scale : 1024 } ) )
460
460
. to . have . lengthOf ( expectations . resampled_length ) ;
461
461
} ) ;
462
462
463
- it ( "should downsize the duration by 2 if we request a half-size scaled resampled waveform " , function ( ) {
463
+ it ( "should return a waveform with half the duration " , function ( ) {
464
464
expect ( instance . resample ( { scale : 1024 } ) )
465
465
. to . have . property ( "duration" , expectations . duration ) ;
466
466
} ) ;
@@ -515,7 +515,7 @@ describe("WaveformData", function() {
515
515
jsonWaveform = new WaveformData ( fixtures . getJSONData ( { channels : 2 } ) ) ;
516
516
} ) ;
517
517
518
- it ( "should return a new WaveformData object with the concatenated result from binary data" , function ( ) {
518
+ it ( "should return a new object with the concatenated result from binary data" , function ( ) {
519
519
var result = binaryWaveform . concat ( binaryWaveform ) ;
520
520
521
521
expect ( result . channels ) . to . equal ( 2 ) ;
@@ -525,7 +525,7 @@ describe("WaveformData", function() {
525
525
. to . deep . equal ( [ 0 , - 10 , 0 , - 5 , - 5 , 0 , 0 , 0 , 0 , - 2 , 0 , - 10 , 0 , - 5 , - 5 , 0 , 0 , 0 , 0 , - 2 ] ) ;
526
526
} ) ;
527
527
528
- it ( "should return a new WaveformData object with the concatenated result from json data" , function ( ) {
528
+ it ( "should return a new object with the concatenated result from json data" , function ( ) {
529
529
var result = jsonWaveform . concat ( jsonWaveform ) ;
530
530
531
531
expect ( result . channels ) . to . equal ( 2 ) ;
@@ -580,7 +580,7 @@ describe("WaveformData", function() {
580
580
expect ( instance . at_time ( 1 ) ) . to . equal ( 93 ) ;
581
581
} ) ;
582
582
583
- it ( "should be able to convert between pixel indexes and times without losing precision" , function ( ) {
583
+ it ( "should convert between pixel indexes and times without losing precision" , function ( ) {
584
584
expect ( instance . at_time ( instance . time ( 0 ) ) ) . to . equal ( 0 ) ;
585
585
expect ( instance . at_time ( instance . time ( 14 ) ) ) . to . equal ( 14 ) ;
586
586
expect ( instance . at_time ( instance . time ( 93 ) ) ) . to . equal ( 93 ) ;
@@ -592,11 +592,11 @@ describe("WaveformData", function() {
592
592
expect ( instance . time ( 0 ) ) . to . equal ( 0 ) ;
593
593
} ) ;
594
594
595
- it ( "should return a time of 0.0015999999999999999 seconds for a given pixel index of 0.15" , function ( ) {
595
+ it ( "should return the time in seconds for a given pixel index of 0.15" , function ( ) {
596
596
expect ( instance . time ( 0.15 ) ) . to . equal ( 0.0015999999999999999 ) ; // 0.15 * 512 / 48000
597
597
} ) ;
598
598
599
- it ( "should return a time of 0.010666666666666666 seconds for a given pixel index of 1" , function ( ) {
599
+ it ( "should return the time in seconds for a given pixel index of 1" , function ( ) {
600
600
expect ( instance . time ( 1 ) ) . to . equal ( 0.010666666666666666 ) ; // 1 * 512 / 48000
601
601
} ) ;
602
602
} ) ;
@@ -629,7 +629,12 @@ describe("WaveformData", function() {
629
629
} ) ;
630
630
631
631
it ( "should allow a WaveformData instance to be stringified as JSON" , function ( ) {
632
- expect ( JSON . stringify ( instance ) ) . to . equal ( '{"version":2,"channels":2,"sample_rate":48000,"samples_per_pixel":512,"bits":8,"length":10,"data":[0,0,0,0,-10,10,-8,8,0,0,-2,2,-5,7,-6,3,-5,7,-6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,2,-3,3]}' ) ;
632
+ expect ( JSON . stringify ( instance ) ) . to . equal (
633
+ "{\"version\":2,\"channels\":2,\"sample_rate\":48000," +
634
+ "\"samples_per_pixel\":512,\"bits\":8,\"length\":10," +
635
+ "\"data\":[0,0,0,0,-10,10,-8,8,0,0,-2,2,-5,7,-6,3," +
636
+ "-5,7,-6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,2,-3,3]}"
637
+ ) ;
633
638
} ) ;
634
639
} ) ;
635
640
} ) ;
0 commit comments