Skip to content

Commit 50a74de

Browse files
committed
fix: use named import from @sanity/client
1 parent 9d05e27 commit 50a74de

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { inject, provide } from 'vue-demi'
22

33
import type { ClientConfig } from '@sanity/client'
4-
import sanityClient from '@sanity/client'
4+
import { createClient } from '@sanity/client'
55
import imageUrlBuilder from '@sanity/image-url'
66

77
import { ensureInstance, useCache } from './cache'
@@ -39,15 +39,15 @@ export function useSanityClient(
3939
) {
4040
ensureInstance()
4141

42-
const client = sanityClient(config)
42+
const client = createClient(config)
4343
const imageBuilder = imageUrlBuilder(config)
4444

4545
provide(clientSymbol, client)
4646
provide(imageBuilderSymbol, imageBuilder)
4747
provide(optionsSymbol, defaultOptions)
4848

4949
if (supportPreview) {
50-
const previewClient = sanityClient({
50+
const previewClient = createClient({
5151
...config,
5252
useCdn: false,
5353
token: undefined,

test/cache.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment happy-dom
33
*/
44
import { ref, watch } from '@vue/composition-api'
5-
import { describe, expect, vi } from 'vitest'
5+
import { describe, expect, it, vi } from 'vitest'
66
import { useCache } from '../src'
77
import { runInSetup } from './helpers/mount'
88

test/image.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import { ref } from '@vue/composition-api'
55
import type { ClientConfig } from '@sanity/client'
6-
import { describe, expect, vi } from 'vitest'
6+
import { describe, expect, it, vi } from 'vitest'
77

88
import { useSanityClient, useSanityImage } from '../src'
99
import { runInSetup } from './helpers/mount'

test/index.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Vue from 'vue'
22
import CompositionApi from '@vue/composition-api'
33

44
import { beforeEach, describe, expect, it, vi } from 'vitest'
5-
import sanityClient from '@sanity/client'
5+
import { createClient } from '@sanity/client'
66

77
import { useSanityClient } from '../src'
88
import { runInSetup } from './helpers/mount'
@@ -23,7 +23,7 @@ const config = {
2323
}
2424

2525
beforeEach(() => {
26-
sanityClient.mockClear()
26+
createClient.mockClear()
2727
;(globalThis.console.error as any).mockClear()
2828
})
2929

@@ -34,9 +34,9 @@ describe('instantiator', () => {
3434
return {}
3535
})
3636

37-
expect(sanityClient).toHaveBeenCalledTimes(2)
38-
expect(sanityClient).toHaveBeenCalledWith(config)
39-
expect(sanityClient).toHaveBeenLastCalledWith({
37+
expect(createClient).toHaveBeenCalledTimes(2)
38+
expect(createClient).toHaveBeenCalledWith(config)
39+
expect(createClient).toHaveBeenLastCalledWith({
4040
...config,
4141
useCdn: false,
4242
token: undefined,

test/query.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import flushPromises from 'flush-promises'
66
import { defineDocument } from 'sanity-typed-queries'
77
import { beforeEach, describe, expect, it, vi } from 'vitest'
88

9-
import sanityClient from '@sanity/client'
9+
import { createClient } from '@sanity/client'
1010

1111
import {
1212
fetch as _fetch,
@@ -40,14 +40,14 @@ const mockListen = vi.fn(() => ({
4040

4141
vi.mock('@sanity/client', () => {
4242
return {
43-
default: vi.fn().mockImplementation(() => {
43+
createClient: vi.fn().mockImplementation(() => {
4444
return { fetch: mockFetch, listen: mockListen }
4545
}),
4646
}
4747
})
4848

4949
beforeEach(() => {
50-
sanityClient.mockClear()
50+
createClient.mockClear()
5151
;(globalThis.console.error as any).mockClear()
5252
mockListen.mockClear()
5353
mockSubscribe.mockClear()

test/ssr.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Vue from 'vue'
22
import { h, ref } from '@vue/composition-api'
33
import { createRenderer } from 'vue-server-renderer'
44

5-
import { describe, expect } from 'vitest'
5+
import { describe, expect, it } from 'vitest'
66

77
import { useCache } from '../src'
88
import { fetcher } from './helpers/utils'

0 commit comments

Comments
 (0)