Files
threshold-ui/ui/admin/tests/acceptance/develop-test.js
T

42 lines
1.2 KiB
JavaScript
Raw Normal View History

/**
2026-01-28 17:09:06 -08:00
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
2023-03-17 14:34:37 -07:00
import { module, test } from 'qunit';
import { visit, getContext } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
2025-08-26 11:31:30 -07:00
import { setupSqlite } from 'api/test-support/helpers/sqlite';
2023-03-17 14:34:37 -07:00
module('Acceptance | develop', function (hooks) {
setupApplicationTest(hooks);
2025-08-26 11:31:30 -07:00
setupSqlite(hooks);
2023-03-17 14:34:37 -07:00
let featuresService;
2025-03-10 13:35:13 -05:00
const DEV_TOGGLE_SELECTOR = '[data-test-dev-edition-toggle]';
2023-03-17 14:34:37 -07:00
2025-04-14 14:27:02 -07:00
hooks.beforeEach(async function () {
2023-03-17 14:34:37 -07:00
const { owner } = getContext();
featuresService = owner.lookup('service:features');
2025-04-14 14:27:02 -07:00
this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
2023-03-17 14:34:37 -07:00
});
test('edition toggle is hidden when `dev-edition-toggle` is false', async function (assert) {
await visit('/');
2025-03-10 13:35:13 -05:00
2023-03-17 14:34:37 -07:00
assert.false(featuresService.isEnabled('dev-edition-toggle'));
2025-03-10 13:35:13 -05:00
assert.dom(DEV_TOGGLE_SELECTOR).doesNotExist();
2023-03-17 14:34:37 -07:00
});
test('edition toggle is visible when `dev-edition-toggle` is true', async function (assert) {
assert.false(featuresService.isEnabled('dev-edition-toggle'));
featuresService.enable('dev-edition-toggle');
2025-03-10 13:35:13 -05:00
2023-03-17 14:34:37 -07:00
await visit('/');
2025-03-10 13:35:13 -05:00
assert.dom(DEV_TOGGLE_SELECTOR).isVisible();
2023-03-17 14:34:37 -07:00
});
});