diff --git a/src/network/__tests__/useBatchTags.test.tsx b/src/network/__tests__/useBatchTags.test.tsx
deleted file mode 100644
index 44f4ab4..0000000
--- a/src/network/__tests__/useBatchTags.test.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import React from 'react'
-import { renderHook, waitFor } from '@testing-library/react'
-import { BatchTagIndex, useBatchTags } from '../useBatchTags'
-import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
-import { AuthProvider } from 'src/utils/AuthContext'
-import { AuthedFetch, useAuthedFetch } from '../useAuthedFetch'
-import { asMock, buildTag, userIsSignedIn } from 'src/testHelpers'
-
-jest.mock('../useAuthedFetch')
-
-describe('useBatchTags', () => {
- let mockAuthedFetch: AuthedFetch
- let tag1: BatchTagIndex
- let tag2: BatchTagIndex
-
- beforeEach(() => {
- userIsSignedIn()
- tag1 = buildTag()
- tag2 = buildTag()
- })
-
- it('queries for an array of tags', async () => {
- const client = new QueryClient()
- mockAuthedFetch = jest.fn()
- asMock(useAuthedFetch).mockReturnValue(mockAuthedFetch)
- asMock(mockAuthedFetch).mockResolvedValue({ statusCode: 200, json: { tags: [tag1, tag2] } })
- const { result } = renderHook(() => useBatchTags([tag1.name, tag2.name]), {
- wrapper: ({ children }) => {
- return (
-
- {children}
-
- )
- },
- })
-
- await waitFor(() => expect(result.current.isSuccess).toEqual(true))
- expect(mockAuthedFetch).toHaveBeenCalledWith({
- path: '/tags/batch',
- method: 'POST',
- body: { tags: [tag1.name, tag2.name] },
- })
- })
-
- it('returns the array of tags', async () => {
- const client = new QueryClient()
- mockAuthedFetch = jest.fn()
- asMock(useAuthedFetch).mockReturnValue(mockAuthedFetch)
- asMock(mockAuthedFetch).mockResolvedValue({ statusCode: 200, json: { tags: [tag1, tag2] } })
- const { result } = renderHook(() => useBatchTags([tag1.name, tag2.name]), {
- wrapper: ({ children }) => {
- return (
-
- {children}
-
- )
- },
- })
- await waitFor(() => expect(result.current.isSuccess).toEqual(true))
- expect(result.current.data).toEqual([tag1, tag2])
- })
-
- it('does not query when there are no tags', async () => {
- const client = new QueryClient()
- mockAuthedFetch = jest.fn()
- asMock(useAuthedFetch).mockReturnValue(mockAuthedFetch)
- asMock(mockAuthedFetch).mockResolvedValue({ statusCode: 200, json: { tags: [tag1, tag2] } })
- const { result } = renderHook(() => useBatchTags([]), {
- wrapper: ({ children }) => {
- return (
-
- {children}
-
- )
- },
- })
- expect(result.current.isLoading).toBeFalsy()
- })
-})
diff --git a/src/network/useBatchTags.ts b/src/network/useBatchTags.ts
deleted file mode 100644
index 782b5b6..0000000
--- a/src/network/useBatchTags.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { useQuery } from '@tanstack/react-query'
-import { useAuthedFetch } from './useAuthedFetch'
-
-export interface BatchTagIndex {
- id: string
- name: string
-}
-
-export const QUERY_KEY = 'useBatchTags'
-
-export const useBatchTags = (tags: string[]) => {
- const authedFetch = useAuthedFetch()
- const queryEnabled = tags.length > 0
-
- return useQuery({
- enabled: queryEnabled,
- queryKey: [QUERY_KEY, tags],
- queryFn: async () => {
- const result = await authedFetch<{ tags: BatchTagIndex[] }>({
- path: '/tags/batch',
- method: 'POST',
- body: { tags },
- })
- return result.json!.tags
- },
- })
-}