summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Rohlfs <brohlfs@google.com>2021-06-08 11:03:10 +0200
committerDavid Ostrovsky <david@ostrovsky.org>2021-06-08 20:38:05 +0200
commit18dd78a5365a89fa33405a4e8e68f60136926bf8 (patch)
treeff32bfd9ce2f4e8366a81a3101fa42183aa1372b
parent69d2f0bf53066f9be37b186ae88ed454f2afa251 (diff)
Add a test for case insensitive repo search
Bug: Issue 14639 Change-Id: I9332c9a665144c0956e2d5e5675313aebef352f1
-rw-r--r--polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.html23
1 files changed, 17 insertions, 6 deletions
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.html b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.html
index 625312de84..1300b2090c 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.html
@@ -36,20 +36,22 @@ limitations under the License.
</test-fixture>
<script>
- let counter;
- const repoGenerator = () => {
+ function createRepo(name, counter) {
return {
- id: `test${++counter}`,
- name: `test`,
+ id: `${name}${counter}`,
+ name: `${name}`,
state: 'ACTIVE',
web_links: [
{
name: 'diffusion',
- url: `https://phabricator.example.org/r/project/test${counter}`,
+ url: `https://phabricator.example.org/r/project/${name}${counter}`,
},
],
};
- };
+ }
+
+ let counter;
+ const repoGenerator = () => createRepo('test', ++counter);
suite('gr-repo-list tests', () => {
let element;
@@ -154,6 +156,15 @@ limitations under the License.
done();
});
});
+
+ test('filter is case insensitive', async () => {
+ const repoStub = sandbox.stub(element.$.restAPI, 'getRepos');
+ const repos = [createRepo('aSDf', 0)];
+ repoStub.withArgs('asdf').returns(Promise.resolve(repos));
+ element._filter = 'asdf';
+ await element._getRepos('asdf', 25, 0);
+ assert.equal(element._repos.length, 1);
+ });
});
suite('loading', () => {