Skip to content

Commit

Permalink
copy from main this test file (#20812)
Browse files Browse the repository at this point in the history
  • Loading branch information
Monkeychip authored May 26, 2023
1 parent 8ece426 commit 0fa0e76
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ui/tests/integration/components/token-expire-warning-test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { find, render, waitUntil } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { addMinutes } from 'date-fns';
import { addMinutes, subMinutes } 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();
const expirationDate = subMinutes(Date.now(), 30);
this.set('expirationDate', expirationDate);

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

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

Expand All @@ -21,11 +21,11 @@ module('Integration | Component | token-expire-warning', function (hooks) {
this.set('expirationDate', expirationDate);

await render(hbs`
<TokenExpireWarning @expirationDate={{expirationDate}}>
<TokenExpireWarning @expirationDate={{this.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');
});
Expand Down

0 comments on commit 0fa0e76

Please sign in to comment.