Skip to content

Commit 9a9544f

Browse files
committed
Add changeset, fix tests
1 parent df3ae9f commit 9a9544f

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@meilisearch/autocomplete-client": minor
3+
"@meilisearch/instant-meilisearch": minor
4+
"eslint-config-meilisearch": patch
5+
---
6+
7+
Change tester from Jest to Vitest.

packages/instant-meilisearch/__tests__/custom-http-client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, beforeAll, test, expect } from 'vitest'
1+
import { describe, beforeAll, test, expect, vi } from 'vitest'
22
import { instantMeiliSearch } from '../src'
33
import { meilisearchClient, dataset } from './assets/utils'
44

@@ -14,7 +14,7 @@ describe('Custom HTTP client tests', () => {
1414
})
1515

1616
test('a custom HTTP client', async () => {
17-
const httpClient = jest.fn(async (url: string, init?: RequestInit) => {
17+
const httpClient = vi.fn(async (url: string, init?: RequestInit) => {
1818
const result = await fetch(url, init)
1919
return await result.json()
2020
})

packages/instant-meilisearch/__tests__/search-resolver.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import { describe, afterEach, test, expect } from 'vitest'
1+
import { describe, afterEach, test, expect, vi } from 'vitest'
22
import { Movies } from './assets/utils'
33
import { instantMeiliSearch } from '../src'
44
import { MeiliSearch } from 'meilisearch'
5-
import { mocked } from 'ts-jest/utils'
65
import { PACKAGE_VERSION } from '../src/package-version'
76
import { MeiliSearchMultiSearchParams } from '../src/types'
87

9-
jest.mock('meilisearch')
10-
118
export const searchResponse = {
129
hits: [],
1310
query: '',
@@ -18,9 +15,11 @@ export const searchResponse = {
1815
exhaustiveNbHits: false,
1916
}
2017

18+
vi.mock('meilisearch')
19+
2120
// Mocking of Meilisearch package
22-
const mockedMeilisearch = mocked(MeiliSearch, true)
23-
const mockedMultiSearch = jest.fn((request) => {
21+
const mockedMeilisearch = vi.mocked(MeiliSearch, true)
22+
const mockedMultiSearch = vi.fn((request) => {
2423
const response = request.queries.map((req: MeiliSearchMultiSearchParams) => ({
2524
...searchResponse,
2625
indexUid: req.indexUid,
@@ -37,7 +36,7 @@ mockedMeilisearch.mockReturnValue({
3736

3837
describe('Cached search tests', () => {
3938
afterEach(() => {
40-
jest.clearAllMocks()
39+
vi.clearAllMocks()
4140
})
4241

4342
test('the same search parameters twice', async () => {

packages/instant-meilisearch/__tests__/sort.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('Sort browser test', () => {
8282
expect(sortRules).toEqual(['_geoPoint(37.8153, -122.4784):asc'])
8383
})
8484

85-
test.only('split no sorting rule', () => {
85+
test('split no sorting rule', () => {
8686
const sortRules = splitSortString('')
8787

8888
expect(sortRules).toEqual([])

0 commit comments

Comments
 (0)