Skip to content

Commit 2f15fb1

Browse files
chore: remove dev flag from profile page (#1114)
* chore: remove dev flag from profile page * fix: add test description * fix: naming for profile route test
1 parent 5c3a76d commit 2f15fb1

File tree

3 files changed

+5
-38
lines changed

3 files changed

+5
-38
lines changed

app/controllers/profile.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,7 @@ const BASE_URL = APPS.API_BACKEND;
99

1010
export default class ProfileController extends Controller {
1111
@service toast;
12-
@service router;
13-
get isDev() {
14-
if (
15-
this.router.currentRoute &&
16-
this.router.currentRoute.queryParams.dev === 'true'
17-
) {
18-
return this.router.currentRoute.queryParams.dev;
19-
}
20-
return false;
21-
}
12+
2213
get imageUploadUrl() {
2314
return `${BASE_URL}/users/picture`;
2415
}

app/routes/profile.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ const BASE_URL = APPS.API_BACKEND;
1010
export default class ProfileRoute extends Route {
1111
@service toast;
1212
@service fastboot;
13-
@service router;
14-
beforeModel(transition) {
15-
if (transition?.to?.queryParams?.dev !== 'true') {
16-
this.router.transitionTo('/page-not-found');
17-
}
18-
}
13+
1914
async model() {
2015
try {
2116
const res = await fetch(`${BASE_URL}/users/isDeveloper`, {

tests/unit/routes/profile-test.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,15 @@ module('Unit | Route | profile', function (hooks) {
1010
hooks.beforeEach(function () {
1111
this.fetchStub = sinon.stub(window, 'fetch');
1212
this.route = this.owner.lookup('route:profile');
13-
sinon.stub(this.route.router, 'transitionTo');
1413
});
1514

1615
hooks.afterEach(function () {
1716
this.fetchStub.restore();
18-
sinon.restore();
1917
});
2018

21-
test('redirects to 404 page if dev flag is not present', function (assert) {
22-
const transition = { to: { queryParams: { dev: 'false' } } };
23-
24-
this.route.beforeModel(transition);
25-
26-
assert.ok(
27-
this.route.router.transitionTo.calledOnceWith('/page-not-found'),
28-
'Redirected to /page-not-found when dev is not true',
29-
);
30-
});
31-
32-
test('allows access when dev flag is true', function (assert) {
33-
const transition = { to: { queryParams: { dev: 'true' } } };
34-
35-
this.route.beforeModel(transition);
36-
37-
assert.ok(
38-
this.route.router.transitionTo.notCalled,
39-
'No redirection occurs when dev query param is true',
40-
);
19+
test('profile route exists and is accessible', function (assert) {
20+
let route = this.owner.lookup('route:profile');
21+
assert.ok(route, 'Test the route exists and is accessible');
4122
});
4223

4324
test('it fetches and transforms model data correctly', async function (assert) {

0 commit comments

Comments
 (0)