refactor: 💡 Remove default value for IP address and port (#1137)

* refactor: 💡 Remove default value for IP address and port
This commit is contained in:
Cameron Perera authored and GitHub committed 2022-06-14 20:39:50 -07:00
1 parent c5416e770a
commit d7e458ab85
2 files changed
+17 -2

No files matched your search

@@ -53,7 +53,7 @@ export default class OnboardingQuickSetupCreateResourcesRoute extends Route {
@notifyError(function () {
return this.intl.t('errors.quick-setup-failed.description');
})
async createResources(hostAddress = '1234', targetPort = '42') {
async createResources(hostAddress, targetPort) {
try {
await this.createOnboardingResourcesAndRedirect(hostAddress, targetPort);
} catch (e) {
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { visit, currentURL, find, click } from '@ember/test-helpers';
import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -11,6 +11,7 @@ module('Acceptance | onboarding | create-resources', function (hooks) {
const urls = {
createResources: '/onboarding/quick-setup/create-resources',
successPath: '/onboarding/quick-setup/create-resources/success',
hostCatalogPath: null,
};
hooks.beforeEach(function () {
@@ -28,7 +29,21 @@ module('Acceptance | onboarding | create-resources', function (hooks) {
test('redirects user to success screen when next is clicked', async function (assert) {
assert.expect(1);
await visit(urls.createResources);
await click('[type="checkbox"]');
await fillIn('[name="hostAddress"]', '0.0.0.0');
await fillIn('[name="targetPort"]', '22');
await click('[type="submit"]');
assert.equal(currentURL(), urls.successPath);
});
test('redirects user to host catalog screen when next is clicked', async function (assert) {
assert.expect(1);
await visit(urls.createResources);
await click('[type="submit"]');
const projectScopeId = this.server.schema.scopes.where({ type: 'project' })
.models[0].scopeId;
const hostCatalogId = this.server.schema.hostCatalogs.all().models[0].id;
urls.hostCatalogPath = `/scopes/${projectScopeId}/host-catalogs/${hostCatalogId}/hosts`;
assert.equal(currentURL(), urls.hostCatalogPath);
});
});