Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2022-09-22 18:10:42 +0300
committerKati Paizee <kpaizee@gitlab.com>2022-09-22 18:10:42 +0300
commit6ef828e917f82a7bd8a621c8a652e3127666ac37 (patch)
tree62b2f8c2f54d46bda3a58e8c45b1cad2e9777514 /spec
parenta5ac9d88bd1251c252d53680e8af0df0eef1d743 (diff)
Add Lunr search UI components
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/search/lunr_search_spec.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/frontend/search/lunr_search_spec.js b/spec/frontend/search/lunr_search_spec.js
new file mode 100644
index 00000000..234fa794
--- /dev/null
+++ b/spec/frontend/search/lunr_search_spec.js
@@ -0,0 +1,26 @@
+/**
+ * @jest-environment jsdom
+ */
+
+import { shallowMount } from '@vue/test-utils';
+import SearchPage from '../../../content/frontend/search/components/lunr_page.vue';
+
+describe('content/frontend/search/components/lunr_page.vue', () => {
+ it('Search form renders', () => {
+ const wrapper = shallowMount(SearchPage);
+ expect(wrapper.findComponent(SearchPage).isVisible()).toBe(true);
+ });
+
+ it('Index fetch failure shows an error', async () => {
+ const wrapper = shallowMount(SearchPage);
+ const fetch = jest.fn(() => {
+ throw new Error('error');
+ });
+
+ try {
+ await fetch('/assets/javascripts/lunr-index.json');
+ } catch (e) {
+ expect(wrapper.find('[data-testid="lunr-error"]').isVisible()).toBe(true);
+ }
+ });
+});