Files
threshold-ui/ui/admin/tests/unit/controllers/scopes/scope/scopes/index-test.js
T
2024-05-31 11:29:24 -07:00

32 lines
880 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { waitUntil } from '@ember/test-helpers';
module('Unit | Controller | scopes/scope/scopes/index', function (hooks) {
setupTest(hooks);
let controller;
hooks.beforeEach(function () {
controller = this.owner.lookup('controller:scopes/scope/scopes/index');
});
test('it exists', function (assert) {
assert.ok(controller);
});
test('handleSearchInput action sets expected values correctly', async function (assert) {
const searchValue = 'test';
controller.handleSearchInput({ target: { value: searchValue } });
await waitUntil(() => controller.search === searchValue);
assert.strictEqual(controller.page, 1);
assert.strictEqual(controller.search, searchValue);
});
});