Quantcast
Viewing all articles
Browse latest Browse all 4826

Can't seem to get helper unit test to pass

@JordanRDesigns wrote:

I'm not sure what's happening here but I can't get the unit test generated for my handlebars helper to pass, even though it works when I actually test in development.

Here is the test

test('Returns a string pointing to the cropped version of an image', function(assert) {
  var result = croppedImage("5579-pkUaYMcLSn.png");
  console.log(result);
  assert.equal(result,'image-cropped.png');
});

And the code to make it pass (should be)

let image = params[0],
    index = image.indexOf('.');
var croppedImageValue = [image.slice(0, index), '-cropped', image.slice(index)].join('');
return croppedImageValue;

Like I said, this code works when testing in development but the unit test won't pass.

I found this stack overflow here

But I tried switching to the format he shows with the _rawFunction but that just tells me _rawFunction is not a function or something like that.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles