Skip to content

Is the first unit tests example correct? #774

Closed

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!

Activity

  1. locks commented on May 17, 2019

    @locks
    Contributor

    You are correct, it should be imported. Would you be willing to send a PR to fix this?

  2. added
    help wanted
    on May 17, 2019
  3. sarbbottam commented on May 19, 2019

    @sarbbottam
    Author

    Sure, I could do that. Could you confirm if only https://github.com/ember-learn/guides-source/blob/master/guides/release/testing/index.md and it will cascade to all the other occurrences or all the occurrences need to be updated?

    I could not find any related information the CONTRIBUTING.md.

  4. added a commit that references this issue on Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions