Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

algolia-search.js 1.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  1. const { dates, supported } = require('../../lib/enterprise-server-releases')
  2. const languageCodes = Object.keys(require('../../lib/languages'))
  3. const { namePrefix } = require('../../lib/search/config')
  4. const remoteIndexNames = require('../../lib/search/cached-index-names.json')
  5. describe('algolia', () => {
  6. test('has remote indexNames in every language for every supported GHE version', () => {
  7. expect(supported.length).toBeGreaterThan(1)
  8. supported.forEach(version => {
  9. languageCodes.forEach(languageCode => {
  10. const indexName = `${namePrefix}-${version}-${languageCode}`
  11. // workaround for GHES release branches not in production yet
  12. if (!remoteIndexNames.includes(indexName)) {
  13. const today = getDate()
  14. const releaseDate = getDate(dates[version].releaseDate)
  15. // if the release date is in the future or today, ignore this version;
  16. // this means if the new index is not uploaded at the time of the release,
  17. // the test will not fail until the following day.
  18. if (releaseDate >= today) return
  19. }
  20. expect(remoteIndexNames.includes(indexName)).toBe(true)
  21. })
  22. })
  23. })
  24. test('has remote indexNames in every language for dotcom', async () => {
  25. expect(languageCodes.length).toBeGreaterThan(0)
  26. languageCodes.forEach(languageCode => {
  27. const indexName = `${namePrefix}-dotcom-${languageCode}`
  28. expect(remoteIndexNames.includes(indexName)).toBe(true)
  29. })
  30. })
  31. })
  32. function getDate (date) {
  33. const dateObj = date ? new Date(date) : new Date()
  34. return dateObj.toISOString().slice(0, 10)
  35. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...