|
1 | 1 | import { updatedQueryBuilder } from './api';
|
2 | 2 |
|
3 |
| -import { searchResponse } from './__fixtures__/responses'; |
4 | 3 | import useData from '../../utils/useData';
|
5 | 4 | import { getChosenResult } from '../../utils/discordTools';
|
6 | 5 |
|
| 6 | +const searchResponse = { |
| 7 | + query: 'document', |
| 8 | + locale: 'en-US', |
| 9 | + page: 1, |
| 10 | + pages: 383, |
| 11 | + start: 1, |
| 12 | + end: 10, |
| 13 | + next: |
| 14 | + 'https://developer.mozilla.org/api/v1/search/en-US?highlight=false&page=2&q=document', |
| 15 | + previous: null, |
| 16 | + count: 3823, |
| 17 | + filters: [ |
| 18 | + { |
| 19 | + name: 'Topics', |
| 20 | + slug: 'topic', |
| 21 | + options: [ |
| 22 | + { |
| 23 | + name: 'APIs and DOM', |
| 24 | + slug: 'api', |
| 25 | + count: 2609, |
| 26 | + active: true, |
| 27 | + urls: { |
| 28 | + active: '/api/v1/search/en-US?highlight=false&q=document&topic=api', |
| 29 | + inactive: '/api/v1/search/en-US?highlight=false&q=document', |
| 30 | + }, |
| 31 | + }, |
| 32 | + ], |
| 33 | + }, |
| 34 | + ], |
| 35 | + documents: [ |
| 36 | + { |
| 37 | + title: 'Document directive', |
| 38 | + slug: 'Glossary/Document_directive', |
| 39 | + locale: 'en-US', |
| 40 | + excerpt: |
| 41 | + 'CSP document directives are used in a Content-Security-Policy header and govern the properties of a document or worker environment to which a policy applies.', |
| 42 | + }, |
| 43 | + { |
| 44 | + title: 'document environment', |
| 45 | + slug: 'Glossary/document_environment', |
| 46 | + locale: 'en-US', |
| 47 | + excerpt: |
| 48 | + "When the JavaScript global environment is a window or an iframe, it is called a document environment. A global environment is an environment that doesn't have an outer environment.", |
| 49 | + }, |
| 50 | + { |
| 51 | + title: 'DOM (Document Object Model)', |
| 52 | + slug: 'Glossary/DOM', |
| 53 | + locale: 'en-US', |
| 54 | + excerpt: |
| 55 | + 'The DOM (Document Object Model) is an API that represents and interacts with any HTML or XML document. The DOM is a document model loaded in the browser and representing the document as a node tree, where each node represents part of the document (e.g. an element, text string, or comment).', |
| 56 | + }, |
| 57 | + { |
| 58 | + title: 'Archived open Web documentation', |
| 59 | + slug: 'Archive/Web', |
| 60 | + locale: 'en-US', |
| 61 | + excerpt: |
| 62 | + 'The documentation listed below is archived, obsolete material about open Web topics.', |
| 63 | + }, |
| 64 | + { |
| 65 | + title: 'Document.documentElement', |
| 66 | + slug: 'Web/API/Document/documentElement', |
| 67 | + locale: 'en-US', |
| 68 | + excerpt: |
| 69 | + 'Document.documentElement returns the Element that is the root element of the document (for example, the html element for HTML documents).', |
| 70 | + }, |
| 71 | + { |
| 72 | + title: 'Document.documentURI', |
| 73 | + slug: 'Web/API/Document/documentURI', |
| 74 | + locale: 'en-US', |
| 75 | + excerpt: |
| 76 | + 'The documentURI read-only property of the Document interface returns the document location as a string.', |
| 77 | + }, |
| 78 | + { |
| 79 | + title: 'Document.documentURIObject', |
| 80 | + slug: 'Web/API/Document/documentURIObject', |
| 81 | + locale: 'en-US', |
| 82 | + excerpt: |
| 83 | + 'The Document.documentURIObject read-only property returns an nsIURI object representing the URI of the document.', |
| 84 | + }, |
| 85 | + { |
| 86 | + title: 'Document', |
| 87 | + slug: 'Web/API/Document', |
| 88 | + locale: 'en-US', |
| 89 | + excerpt: |
| 90 | + "The Document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree.", |
| 91 | + }, |
| 92 | + { |
| 93 | + title: 'Document()', |
| 94 | + slug: 'Web/API/Document/Document', |
| 95 | + locale: 'en-US', |
| 96 | + excerpt: |
| 97 | + "The Document constructor creates a new Document object that is a web page loaded in the browser and serving as an entry point into the page's content.", |
| 98 | + }, |
| 99 | + { |
| 100 | + title: '@document', |
| 101 | + slug: 'Web/CSS/@document', |
| 102 | + locale: 'en-US', |
| 103 | + excerpt: |
| 104 | + 'The @document CSS at-rule restricts the style rules contained within it based on the URL of the document. It is designed primarily for user-defined style sheets, though it can be used on author-defined style sheets, too.', |
| 105 | + }, |
| 106 | + ], |
| 107 | +}; |
| 108 | + |
7 | 109 | describe('updatedMDNQuery', () => {
|
8 | 110 | const mockUseData: jest.MockedFunction<typeof useData> = jest.fn();
|
9 | 111 | const mockChoose: jest.MockedFunction<typeof getChosenResult> = jest.fn();
|
|
0 commit comments