Skip to content

Is the first unit tests example correct? #774

@sarbbottam

Description

@sarbbottam

Hi there, thanks for maintaining and continuously improving ember-learn and ember guides. I am wondering if the below example is complete.

import { module, test } from 'qunit';

module('relativeDate', function(hooks) {
  test('format relative dates correctly', function(assert) {
    assert.equal(relativeDate('2018/01/28 22:24:30'), 'just now');
    assert.equal(relativeDate('2018/01/28 22:23:30'), '1 minute ago');
    assert.equal(relativeDate('2018/01/28 21:23:30'), '1 hour ago');
    assert.equal(relativeDate('2018/01/27 22:23:30'), 'Yesterday');
    assert.equal(relativeDate('2018/01/26 22:23:30'), '2 days ago');
  });
});

I cannot figure out how relativeDate function available in the above test code.
Should it have been statically imported or looked up from the container?

Something like:

import { relativeDate } from '<app-context>/utils/date-utils';

Best!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions