<commit_before>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { addMinutes } from 'date-fns';

module('Integration | Component | token-expire-warning', function (hooks) {
  setupRenderingTest(hooks);

  test('it renders a warning when the token is expired', async function (assert) {
    const expirationDate = Date.now();
    this.set('expirationDate', expirationDate);

    await render(hbs`<TokenExpireWarning @expirationDate={{expirationDate}}/>`);

    assert.dom().includesText('Your auth token expired on');
  });

  test('it does not render a warning when the token is not expired', async function (assert) {
    const expirationDate = addMinutes(Date.now(), 30);
    this.set('expirationDate', expirationDate);

    await render(hbs`
      <TokenExpireWarning @expirationDate={{expirationDate}}>
        <p>Do not worry, your token has not expired.</p>
      </TokenExpireWarning>
    `);

    assert.dom().doesNotIncludeText('Your auth token expired on');
    assert.dom().includesText('Do not worry');
  });
});<commit_msg>add waitUntil (#16072)<commit_after>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { find, render, waitUntil } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { addMinutes } from 'date-fns';

module('Integration | Component | token-expire-warning', function (hooks) {
  setupRenderingTest(hooks);

  test('it renders a warning when the token is expired', async function (assert) {
    const expirationDate = Date.now();
    this.set('expirationDate', expirationDate);

    await render(hbs`<TokenExpireWarning @expirationDate={{expirationDate}}/>`);
    await waitUntil(() => find('#modal-overlays'));
    assert.dom().includesText('Your auth token expired on');
  });

  test('it does not render a warning when the token is not expired', async function (assert) {
    const expirationDate = addMinutes(Date.now(), 30);
    this.set('expirationDate', expirationDate);

    await render(hbs`
      <TokenExpireWarning @expirationDate={{expirationDate}}>
        <p>Do not worry, your token has not expired.</p>
      </TokenExpireWarning>
    `);
    await waitUntil(() => find('#modal-overlays'));
    assert.dom().doesNotIncludeText('Your auth token expired on');
    assert.dom().includesText('Do not worry');
  });
});
{'fraction_non_alphanumeric': 0.14337641357027464, 'fraction_numerical': 0.0036348949919224557, 'mean_word_length': 4.591422121896162, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1370697', 'n_tokens_mistral': 738, 'n_tokens_neox': 720, 'n_words': 198}