thumbsupply icon indicating copy to clipboard operation
thumbsupply copied to clipboard

Tests don't pass on master

Open kj800x opened this issue 6 years ago • 3 comments

> [email protected] test /home/kevin/Desktop/thumbsupply
> mocha



  thumbsupply
    #generateThumbnail()
      ✓ should be creating the thumbnail (300ms)
      1) should be creating the thumbnail as specified
    #lookupThumbnail()
      ✓ should lookup and fetch the thumbnail
      ✓ should not lookup and fetch the expired thumbnail


  3 passing (711ms)
  1 failing

  1) thumbsupply
       #generateThumbnail()
         should be creating the thumbnail as specified:

      AssertionError [ERR_ASSERTION]: 136 == 135
      + expected - actual

      -136
      +135
      
      at testResolution (test/test.js:16:16)
      at thumbsupply.generateThumbnail.then.thumbnail (test/test.js:49:21)
      at process.internalTickCallback (internal/process/next_tick.js:77:7)



npm ERR! Test failed.  See above for more details.

It looks like maybe the assertion value is simply wrong?

kj800x avatar Jan 08 '19 05:01 kj800x

Assertion value is right. Irrespective of the requested thumbnail dimensions, I always find the actual value is offset by 1px.

RyanAfrish7 avatar Jan 26 '19 13:01 RyanAfrish7

Interesting leads here. https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/910

RyanAfrish7 avatar Jun 12 '19 19:06 RyanAfrish7

Regardless of the discussion on node-fluent-ffmpeg, we should probably do something so that the tests pass. If node-fluent-ffmpeg automatically does the rounding and there's nothing we can do to change that, we should probably just document that the rounding happens and update the test to account for it.

Most users probably don't care if the generated thumb is 1px off of the requested value. Most people also probably request even resolutions or just use the default ThumbSize.MEDIUM or ThumbSize.LARGE, in which case they don't care about the exact resolution.

The only case where it could be problematic would be if someone was relying on getting an image with the exact dimensions that they requested, but since the library already will change dimensions to ensure the aspect ratio is correct, I don't think we should worry about that case.

kj800x avatar Jul 30 '19 18:07 kj800x