Rename `data` to `ctx` whenever using `PageContext`
This was just inconsistent.
Release-Notes: skip
Google-Bug-Id: b/244279450
Change-Id: I554a800d4d5c7715f515c67a8cc74b24f12a4e6e
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
index a766176..47461eb 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
@@ -202,7 +202,7 @@
test('redirectIfNotLoggedIn while logged in', () => {
stubRestApi('getLoggedIn').returns(Promise.resolve(true));
- const data = {
+ const ctx = {
save() {},
handled: true,
canonicalPath: '',
@@ -215,7 +215,7 @@
params: {test: 'test'},
};
const redirectStub = sinon.stub(router, 'redirectToLogin');
- return router.redirectIfNotLoggedIn(data).then(() => {
+ return router.redirectIfNotLoggedIn(ctx).then(() => {
assert.isFalse(redirectStub.called);
});
});
@@ -223,7 +223,7 @@
test('redirectIfNotLoggedIn while logged out', () => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
const redirectStub = sinon.stub(router, 'redirectToLogin');
- const data = {
+ const ctx = {
save() {},
handled: true,
canonicalPath: '',
@@ -237,7 +237,7 @@
};
return new Promise(resolve => {
router
- .redirectIfNotLoggedIn(data)
+ .redirectIfNotLoggedIn(ctx)
.then(() => {
assert.isTrue(false, 'Should never execute');
})
@@ -274,15 +274,15 @@
let setStateStub: sinon.SinonStub;
let handlePassThroughRoute: sinon.SinonStub;
- // Simple route handlers are direct mappings from parsed route data to a
- // new set of app.params. This test helper asserts that passing `data`
+ // Simple route handlers are direct mappings from parsed route ctx to a
+ // new set of app.params. This test helper asserts that passing `ctx`
// into `methodName` results in setting the params specified in `params`.
- function assertDataToParams(
- data: PageContext,
+ function assertctxToParams(
+ ctx: PageContext,
methodName: string,
params: AppElementParams
) {
- (router as any)[methodName](data);
+ (router as any)[methodName](ctx);
assert.deepEqual(setStateStub.lastCall.args[0], params);
}
@@ -329,24 +329,24 @@
});
test('handleSettingsLegacyRoute', () => {
- const data = {...createPageContext(), params: {0: 'my-token'}};
- assertDataToParams(data, 'handleSettingsLegacyRoute', {
+ const ctx = {...createPageContext(), params: {0: 'my-token'}};
+ assertctxToParams(ctx, 'handleSettingsLegacyRoute', {
view: GerritView.SETTINGS,
emailToken: 'my-token',
});
});
test('handleSettingsLegacyRoute with +', () => {
- const data = {...createPageContext(), params: {0: 'my-token test'}};
- assertDataToParams(data, 'handleSettingsLegacyRoute', {
+ const ctx = {...createPageContext(), params: {0: 'my-token test'}};
+ assertctxToParams(ctx, 'handleSettingsLegacyRoute', {
view: GerritView.SETTINGS,
emailToken: 'my-token+test',
});
});
test('handleSettingsRoute', () => {
- const data = createPageContext();
- assertDataToParams(data, 'handleSettingsRoute', {
+ const ctx = createPageContext();
+ assertctxToParams(ctx, 'handleSettingsRoute', {
view: GerritView.SETTINGS,
});
});
@@ -398,19 +398,19 @@
});
test('handleQueryRoute', () => {
- const data: PageContext = {
+ const ctx: PageContext = {
...createPageContext(),
params: {0: 'project:foo/bar/baz'},
};
- assertDataToParams(data, 'handleQueryRoute', {
+ assertctxToParams(ctx, 'handleQueryRoute', {
view: GerritView.SEARCH,
query: 'project:foo/bar/baz',
offset: undefined,
});
- data.params[1] = '123';
- data.params[2] = '123';
- assertDataToParams(data, 'handleQueryRoute', {
+ ctx.params[1] = '123';
+ ctx.params[2] = '123';
+ assertctxToParams(ctx, 'handleQueryRoute', {
view: GerritView.SEARCH,
query: 'project:foo/bar/baz',
offset: '123',
@@ -425,11 +425,11 @@
});
test('handleChangeIdQueryRoute', () => {
- const data = {
+ const ctx = {
...createPageContext(),
params: {0: 'I0123456789abcdef0123456789abcdef01234567'},
};
- assertDataToParams(data, 'handleChangeIdQueryRoute', {
+ assertctxToParams(ctx, 'handleChangeIdQueryRoute', {
view: GerritView.SEARCH,
query: 'I0123456789abcdef0123456789abcdef01234567',
});
@@ -463,17 +463,17 @@
suite('handleRootRoute', () => {
test('closes for closeAfterLogin', () => {
- const data = {...createPageContext(), querystring: 'closeAfterLogin'};
+ const ctx = {...createPageContext(), querystring: 'closeAfterLogin'};
const closeStub = sinon.stub(window, 'close');
- const result = router.handleRootRoute(data);
+ const result = router.handleRootRoute(ctx);
assert.isNotOk(result);
assert.isTrue(closeStub.called);
assert.isFalse(redirectStub.called);
});
test('redirects to dashboard if logged in', () => {
- const data = {...createPageContext(), canonicalPath: '/', path: '/'};
- const result = router.handleRootRoute(data);
+ const ctx = {...createPageContext(), canonicalPath: '/', path: '/'};
+ const result = router.handleRootRoute(ctx);
assert.isOk(result);
return result!.then(() => {
assert.isTrue(redirectStub.calledWithExactly('/dashboard/self'));
@@ -482,8 +482,8 @@
test('redirects to open changes if not logged in', () => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
- const data = {...createPageContext(), canonicalPath: '/', path: '/'};
- const result = router.handleRootRoute(data);
+ const ctx = {...createPageContext(), canonicalPath: '/', path: '/'};
+ const result = router.handleRootRoute(ctx);
assert.isOk(result);
return result!.then(() => {
assert.isTrue(
@@ -494,73 +494,73 @@
suite('GWT hash-path URLs', () => {
test('redirects hash-path URLs', () => {
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/#/foo/bar/baz',
hash: '/foo/bar/baz',
};
- const result = router.handleRootRoute(data);
+ const result = router.handleRootRoute(ctx);
assert.isNotOk(result);
assert.isTrue(redirectStub.called);
assert.isTrue(redirectStub.calledWithExactly('/foo/bar/baz'));
});
test('redirects hash-path URLs w/o leading slash', () => {
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/#foo/bar/baz',
hash: 'foo/bar/baz',
};
- const result = router.handleRootRoute(data);
+ const result = router.handleRootRoute(ctx);
assert.isNotOk(result);
assert.isTrue(redirectStub.called);
assert.isTrue(redirectStub.calledWithExactly('/foo/bar/baz'));
});
test('normalizes "/ /" in hash to "/+/"', () => {
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/#/foo/bar/+/123/4',
hash: '/foo/bar/ /123/4',
};
- const result = router.handleRootRoute(data);
+ const result = router.handleRootRoute(ctx);
assert.isNotOk(result);
assert.isTrue(redirectStub.called);
assert.isTrue(redirectStub.calledWithExactly('/foo/bar/+/123/4'));
});
test('prepends baseurl to hash-path', () => {
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/#/foo/bar',
hash: '/foo/bar',
};
stubBaseUrl('/baz');
- const result = router.handleRootRoute(data);
+ const result = router.handleRootRoute(ctx);
assert.isNotOk(result);
assert.isTrue(redirectStub.called);
assert.isTrue(redirectStub.calledWithExactly('/baz/foo/bar'));
});
test('normalizes /VE/ settings hash-paths', () => {
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/#/VE/foo/bar',
hash: '/VE/foo/bar',
};
- const result = router.handleRootRoute(data);
+ const result = router.handleRootRoute(ctx);
assert.isNotOk(result);
assert.isTrue(redirectStub.called);
assert.isTrue(redirectStub.calledWithExactly('/settings/VE/foo/bar'));
});
test('does not drop "inner hashes"', () => {
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/#/foo/bar#baz',
hash: '/foo/bar',
};
- const result = router.handleRootRoute(data);
+ const result = router.handleRootRoute(ctx);
assert.isNotOk(result);
assert.isTrue(redirectStub.called);
assert.isTrue(redirectStub.calledWithExactly('/foo/bar#baz'));
@@ -577,12 +577,12 @@
test('own dashboard but signed out redirects to login', () => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/dashboard/',
params: {0: 'seLF'},
};
- return router.handleDashboardRoute(data).then(() => {
+ return router.handleDashboardRoute(ctx).then(() => {
assert.isTrue(redirectToLoginStub.calledOnce);
assert.isFalse(redirectStub.called);
assert.isFalse(setStateStub.called);
@@ -591,12 +591,12 @@
test('non-self dashboard but signed out does not redirect', () => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/dashboard/',
params: {0: 'foo'},
};
- return router.handleDashboardRoute(data).then(() => {
+ return router.handleDashboardRoute(ctx).then(() => {
assert.isFalse(redirectToLoginStub.called);
assert.isFalse(setStateStub.called);
assert.isTrue(redirectStub.calledOnce);
@@ -605,12 +605,12 @@
});
test('dashboard while signed in sets params', () => {
- const data = {
+ const ctx = {
...createPageContext(),
canonicalPath: '/dashboard/',
params: {0: 'foo'},
};
- return router.handleDashboardRoute(data).then(() => {
+ return router.handleDashboardRoute(ctx).then(() => {
assert.isFalse(redirectToLoginStub.called);
assert.isFalse(redirectStub.called);
assert.isTrue(setStateStub.calledOnce);
@@ -630,13 +630,13 @@
});
test('no user specified', () => {
- const data: PageContext = {
+ const ctx: PageContext = {
...createPageContext(),
canonicalPath: '/dashboard/',
params: {0: ''},
querystring: '',
};
- return router.handleCustomDashboardRoute(data).then(() => {
+ return router.handleCustomDashboardRoute(ctx).then(() => {
assert.isFalse(setStateStub.called);
assert.isTrue(redirectStub.called);
assert.equal(redirectStub.lastCall.args[0], '/dashboard/self');
@@ -644,13 +644,13 @@
});
test('custom dashboard without title', () => {
- const data: PageContext = {
+ const ctx: PageContext = {
...createPageContext(),
canonicalPath: '/dashboard/',
params: {0: ''},
querystring: '?a=b&c&d=e',
};
- return router.handleCustomDashboardRoute(data).then(() => {
+ return router.handleCustomDashboardRoute(ctx).then(() => {
assert.isFalse(redirectStub.called);
assert.isTrue(setStateStub.calledOnce);
assert.deepEqual(setStateStub.lastCall.args[0], {
@@ -666,13 +666,13 @@
});
test('custom dashboard with title', () => {
- const data: PageContext = {
+ const ctx: PageContext = {
...createPageContext(),
canonicalPath: '/dashboard/',
params: {0: ''},
querystring: '?a=b&c&d=&=e&title=t',
};
- return router.handleCustomDashboardRoute(data).then(() => {
+ return router.handleCustomDashboardRoute(ctx).then(() => {
assert.isFalse(redirectToLoginStub.called);
assert.isFalse(redirectStub.called);
assert.isTrue(setStateStub.calledOnce);
@@ -686,13 +686,13 @@
});
test('custom dashboard with foreach', () => {
- const data: PageContext = {
+ const ctx: PageContext = {
...createPageContext(),
canonicalPath: '/dashboard/',
params: {0: ''},
querystring: '?a=b&c&d=&=e&foreach=is:open',
};
- return router.handleCustomDashboardRoute(data).then(() => {
+ return router.handleCustomDashboardRoute(ctx).then(() => {
assert.isFalse(redirectToLoginStub.called);
assert.isFalse(redirectStub.called);
assert.isTrue(setStateStub.calledOnce);
@@ -708,15 +708,15 @@
suite('group routes', () => {
test('handleGroupInfoRoute', () => {
- const data = {...createPageContext(), params: {0: '1234'}};
- router.handleGroupInfoRoute(data);
+ const ctx = {...createPageContext(), params: {0: '1234'}};
+ router.handleGroupInfoRoute(ctx);
assert.isTrue(redirectStub.calledOnce);
assert.equal(redirectStub.lastCall.args[0], '/admin/groups/1234');
});
test('handleGroupAuditLogRoute', () => {
- const data = {...createPageContext(), params: {0: '1234'}};
- assertDataToParams(data, 'handleGroupAuditLogRoute', {
+ const ctx = {...createPageContext(), params: {0: '1234'}};
+ assertctxToParams(ctx, 'handleGroupAuditLogRoute', {
view: GerritView.GROUP,
detail: GroupDetailView.LOG,
groupId: '1234' as GroupId,
@@ -724,8 +724,8 @@
});
test('handleGroupMembersRoute', () => {
- const data = {...createPageContext(), params: {0: '1234'}};
- assertDataToParams(data, 'handleGroupMembersRoute', {
+ const ctx = {...createPageContext(), params: {0: '1234'}};
+ assertctxToParams(ctx, 'handleGroupMembersRoute', {
view: GerritView.GROUP,
detail: GroupDetailView.MEMBERS,
groupId: '1234' as GroupId,
@@ -733,8 +733,8 @@
});
test('handleGroupListOffsetRoute', () => {
- const data = createPageContext();
- assertDataToParams(data, 'handleGroupListOffsetRoute', {
+ const ctx = createPageContext();
+ assertctxToParams(ctx, 'handleGroupListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.GROUPS,
offset: 0,
@@ -742,8 +742,8 @@
openCreateModal: false,
});
- data.params[1] = '42';
- assertDataToParams(data, 'handleGroupListOffsetRoute', {
+ ctx.params[1] = '42';
+ assertctxToParams(ctx, 'handleGroupListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.GROUPS,
offset: '42',
@@ -751,8 +751,8 @@
openCreateModal: false,
});
- data.hash = 'create';
- assertDataToParams(data, 'handleGroupListOffsetRoute', {
+ ctx.hash = 'create';
+ assertctxToParams(ctx, 'handleGroupListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.GROUPS,
offset: '42',
@@ -762,11 +762,11 @@
});
test('handleGroupListFilterOffsetRoute', () => {
- const data = {
+ const ctx = {
...createPageContext(),
params: {filter: 'foo', offset: '42'},
};
- assertDataToParams(data, 'handleGroupListFilterOffsetRoute', {
+ assertctxToParams(ctx, 'handleGroupListFilterOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.GROUPS,
offset: '42',
@@ -775,8 +775,8 @@
});
test('handleGroupListFilterRoute', () => {
- const data = {...createPageContext(), params: {filter: 'foo'}};
- assertDataToParams(data, 'handleGroupListFilterRoute', {
+ const ctx = {...createPageContext(), params: {filter: 'foo'}};
+ assertctxToParams(ctx, 'handleGroupListFilterRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.GROUPS,
filter: 'foo',
@@ -784,8 +784,8 @@
});
test('handleGroupRoute', () => {
- const data = {...createPageContext(), params: {0: '4321'}};
- assertDataToParams(data, 'handleGroupRoute', {
+ const ctx = {...createPageContext(), params: {0: '4321'}};
+ assertctxToParams(ctx, 'handleGroupRoute', {
view: GerritView.GROUP,
groupId: '4321' as GroupId,
});
@@ -794,22 +794,22 @@
suite('repo routes', () => {
test('handleProjectsOldRoute', () => {
- const data = {...createPageContext(), params: {}};
- router.handleProjectsOldRoute(data);
+ const ctx = {...createPageContext(), params: {}};
+ router.handleProjectsOldRoute(ctx);
assert.isTrue(redirectStub.calledOnce);
assert.equal(redirectStub.lastCall.args[0], '/admin/repos/');
});
test('handleProjectsOldRoute test', () => {
- const data = {...createPageContext(), params: {1: 'test'}};
- router.handleProjectsOldRoute(data);
+ const ctx = {...createPageContext(), params: {1: 'test'}};
+ router.handleProjectsOldRoute(ctx);
assert.isTrue(redirectStub.calledOnce);
assert.equal(redirectStub.lastCall.args[0], '/admin/repos/test');
});
test('handleProjectsOldRoute test,branches', () => {
- const data = {...createPageContext(), params: {1: 'test,branches'}};
- router.handleProjectsOldRoute(data);
+ const ctx = {...createPageContext(), params: {1: 'test,branches'}};
+ router.handleProjectsOldRoute(ctx);
assert.isTrue(redirectStub.calledOnce);
assert.equal(
redirectStub.lastCall.args[0],
@@ -818,8 +818,8 @@
});
test('handleRepoRoute', () => {
- const data = {...createPageContext(), path: '/admin/repos/test'};
- router.handleRepoRoute(data);
+ const ctx = {...createPageContext(), path: '/admin/repos/test'};
+ router.handleRepoRoute(ctx);
assert.isTrue(redirectStub.calledOnce);
assert.equal(
redirectStub.lastCall.args[0],
@@ -828,8 +828,8 @@
});
test('handleRepoGeneralRoute', () => {
- const data = {...createPageContext(), params: {0: '4321'}};
- assertDataToParams(data, 'handleRepoGeneralRoute', {
+ const ctx = {...createPageContext(), params: {0: '4321'}};
+ assertctxToParams(ctx, 'handleRepoGeneralRoute', {
view: GerritView.REPO,
detail: RepoDetailView.GENERAL,
repo: '4321' as RepoName,
@@ -837,8 +837,8 @@
});
test('handleRepoCommandsRoute', () => {
- const data = {...createPageContext(), params: {0: '4321'}};
- assertDataToParams(data, 'handleRepoCommandsRoute', {
+ const ctx = {...createPageContext(), params: {0: '4321'}};
+ assertctxToParams(ctx, 'handleRepoCommandsRoute', {
view: GerritView.REPO,
detail: RepoDetailView.COMMANDS,
repo: '4321' as RepoName,
@@ -846,8 +846,8 @@
});
test('handleRepoAccessRoute', () => {
- const data = {...createPageContext(), params: {0: '4321'}};
- assertDataToParams(data, 'handleRepoAccessRoute', {
+ const ctx = {...createPageContext(), params: {0: '4321'}};
+ assertctxToParams(ctx, 'handleRepoAccessRoute', {
view: GerritView.REPO,
detail: RepoDetailView.ACCESS,
repo: '4321' as RepoName,
@@ -856,11 +856,11 @@
suite('branch list routes', () => {
test('handleBranchListOffsetRoute', () => {
- const data: PageContext = {
+ const ctx: PageContext = {
...createPageContext(),
params: {0: '4321'},
};
- assertDataToParams(data, 'handleBranchListOffsetRoute', {
+ assertctxToParams(ctx, 'handleBranchListOffsetRoute', {
view: GerritView.REPO,
detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
@@ -868,8 +868,8 @@
filter: null,
});
- data.params[2] = '42';
- assertDataToParams(data, 'handleBranchListOffsetRoute', {
+ ctx.params[2] = '42';
+ assertctxToParams(ctx, 'handleBranchListOffsetRoute', {
view: GerritView.REPO,
detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
@@ -879,11 +879,11 @@
});
test('handleBranchListFilterOffsetRoute', () => {
- const data = {
+ const ctx = {
...createPageContext(),
params: {repo: '4321', filter: 'foo', offset: '42'},
};
- assertDataToParams(data, 'handleBranchListFilterOffsetRoute', {
+ assertctxToParams(ctx, 'handleBranchListFilterOffsetRoute', {
view: GerritView.REPO,
detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
@@ -893,11 +893,11 @@
});
test('handleBranchListFilterRoute', () => {
- const data = {
+ const ctx = {
...createPageContext(),
params: {repo: '4321', filter: 'foo'},
};
- assertDataToParams(data, 'handleBranchListFilterRoute', {
+ assertctxToParams(ctx, 'handleBranchListFilterRoute', {
view: GerritView.REPO,
detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
@@ -908,8 +908,8 @@
suite('tag list routes', () => {
test('handleTagListOffsetRoute', () => {
- const data = {...createPageContext(), params: {0: '4321'}};
- assertDataToParams(data, 'handleTagListOffsetRoute', {
+ const ctx = {...createPageContext(), params: {0: '4321'}};
+ assertctxToParams(ctx, 'handleTagListOffsetRoute', {
view: GerritView.REPO,
detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
@@ -919,11 +919,11 @@
});
test('handleTagListFilterOffsetRoute', () => {
- const data = {
+ const ctx = {
...createPageContext(),
params: {repo: '4321', filter: 'foo', offset: '42'},
};
- assertDataToParams(data, 'handleTagListFilterOffsetRoute', {
+ assertctxToParams(ctx, 'handleTagListFilterOffsetRoute', {
view: GerritView.REPO,
detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
@@ -933,19 +933,19 @@
});
test('handleTagListFilterRoute', () => {
- const data: PageContext = {
+ const ctx: PageContext = {
...createPageContext(),
params: {repo: '4321'},
};
- assertDataToParams(data, 'handleTagListFilterRoute', {
+ assertctxToParams(ctx, 'handleTagListFilterRoute', {
view: GerritView.REPO,
detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
filter: null,
});
- data.params.filter = 'foo';
- assertDataToParams(data, 'handleTagListFilterRoute', {
+ ctx.params.filter = 'foo';
+ assertctxToParams(ctx, 'handleTagListFilterRoute', {
view: GerritView.REPO,
detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
@@ -956,8 +956,8 @@
suite('repo list routes', () => {
test('handleRepoListOffsetRoute', () => {
- const data = createPageContext();
- assertDataToParams(data, 'handleRepoListOffsetRoute', {
+ const ctx = createPageContext();
+ assertctxToParams(ctx, 'handleRepoListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.REPOS,
offset: 0,
@@ -965,8 +965,8 @@
openCreateModal: false,
});
- data.params[1] = '42';
- assertDataToParams(data, 'handleRepoListOffsetRoute', {
+ ctx.params[1] = '42';
+ assertctxToParams(ctx, 'handleRepoListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.REPOS,
offset: '42',
@@ -974,8 +974,8 @@
openCreateModal: false,
});
- data.hash = 'create';
- assertDataToParams(data, 'handleRepoListOffsetRoute', {
+ ctx.hash = 'create';
+ assertctxToParams(ctx, 'handleRepoListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.REPOS,
offset: '42',
@@ -985,11 +985,11 @@
});
test('handleRepoListFilterOffsetRoute', () => {
- const data = {
+ const ctx = {
...createPageContext(),
params: {filter: 'foo', offset: '42'},
};
- assertDataToParams(data, 'handleRepoListFilterOffsetRoute', {
+ assertctxToParams(ctx, 'handleRepoListFilterOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.REPOS,
offset: '42',
@@ -998,15 +998,15 @@
});
test('handleRepoListFilterRoute', () => {
- const data = createPageContext();
- assertDataToParams(data, 'handleRepoListFilterRoute', {
+ const ctx = createPageContext();
+ assertctxToParams(ctx, 'handleRepoListFilterRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.REPOS,
filter: null,
});
- data.params.filter = 'foo';
- assertDataToParams(data, 'handleRepoListFilterRoute', {
+ ctx.params.filter = 'foo';
+ assertctxToParams(ctx, 'handleRepoListFilterRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.REPOS,
filter: 'foo',
@@ -1017,16 +1017,16 @@
suite('plugin routes', () => {
test('handlePluginListOffsetRoute', () => {
- const data = createPageContext();
- assertDataToParams(data, 'handlePluginListOffsetRoute', {
+ const ctx = createPageContext();
+ assertctxToParams(ctx, 'handlePluginListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.PLUGINS,
offset: 0,
filter: null,
});
- data.params[1] = '42';
- assertDataToParams(data, 'handlePluginListOffsetRoute', {
+ ctx.params[1] = '42';
+ assertctxToParams(ctx, 'handlePluginListOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.PLUGINS,
offset: '42',
@@ -1035,11 +1035,11 @@
});
test('handlePluginListFilterOffsetRoute', () => {
- const data = {
+ const ctx = {
...createPageContext(),
params: {filter: 'foo', offset: '42'},
};
- assertDataToParams(data, 'handlePluginListFilterOffsetRoute', {
+ assertctxToParams(ctx, 'handlePluginListFilterOffsetRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.PLUGINS,
offset: '42',
@@ -1048,15 +1048,15 @@
});
test('handlePluginListFilterRoute', () => {
- const data = createPageContext();
- assertDataToParams(data, 'handlePluginListFilterRoute', {
+ const ctx = createPageContext();
+ assertctxToParams(ctx, 'handlePluginListFilterRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.PLUGINS,
filter: null,
});
- data.params.filter = 'foo';
- assertDataToParams(data, 'handlePluginListFilterRoute', {
+ ctx.params.filter = 'foo';
+ assertctxToParams(ctx, 'handlePluginListFilterRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.PLUGINS,
filter: 'foo',
@@ -1064,8 +1064,8 @@
});
test('handlePluginListRoute', () => {
- const data = createPageContext();
- assertDataToParams(data, 'handlePluginListRoute', {
+ const ctx = createPageContext();
+ assertctxToParams(ctx, 'handlePluginListRoute', {
view: GerritView.ADMIN,
adminView: AdminChildView.PLUGINS,
});
@@ -1074,8 +1074,8 @@
suite('change/diff routes', () => {
test('handleChangeNumberLegacyRoute', () => {
- const data = {...createPageContext(), params: {0: '12345'}};
- router.handleChangeNumberLegacyRoute(data);
+ const ctx = {...createPageContext(), params: {0: '12345'}};
+ router.handleChangeNumberLegacyRoute(ctx);
assert.isTrue(redirectStub.calledOnce);
assert.isTrue(redirectStub.calledWithExactly('/c/12345'));
});
@@ -1135,7 +1135,7 @@
test('change view', () => {
const ctx = makeParams('', '');
- assertDataToParams(ctx, 'handleChangeRoute', {
+ assertctxToParams(ctx, 'handleChangeRoute', {
view: GerritView.CHANGE,
project: 'foo/bar' as RepoName,
changeNum: 1234 as NumericChangeId,
@@ -1153,7 +1153,7 @@
queryMap.set('select', 'sss');
queryMap.set('attempt', '1');
ctx.querystring = queryMap.toString();
- assertDataToParams(ctx, 'handleChangeRoute', {
+ assertctxToParams(ctx, 'handleChangeRoute', {
view: GerritView.CHANGE,
project: 'foo/bar' as RepoName,
changeNum: 1234 as NumericChangeId,
@@ -1191,7 +1191,7 @@
test('diff view', () => {
const ctx = makeParams('foo/bar/baz', 'b44');
- assertDataToParams(ctx, 'handleDiffRoute', {
+ assertctxToParams(ctx, 'handleDiffRoute', {
view: GerritView.DIFF,
project: 'foo/bar' as RepoName,
changeNum: 1234 as NumericChangeId,
@@ -1212,7 +1212,7 @@
'264833', // changeNum
'00049681_f34fd6a9', // commentId
]);
- assertDataToParams(
+ assertctxToParams(
{params: groups!.slice(1)} as any,
'handleCommentRoute',
{
@@ -1233,7 +1233,7 @@
'264833', // changeNum
'00049681_f34fd6a9', // commentId
]);
- assertDataToParams(
+ assertctxToParams(
{params: groups!.slice(1)} as any,
'handleCommentsRoute',
{
@@ -1326,7 +1326,7 @@
test('handlePluginScreen', () => {
const ctx = {...createPageContext(), params: {0: 'foo', 1: 'bar'}};
- assertDataToParams(ctx, 'handlePluginScreen', {
+ assertctxToParams(ctx, 'handlePluginScreen', {
view: GerritView.PLUGIN_SCREEN,
plugin: 'foo',
screen: 'bar',