Skip to content

Commit

Permalink
TG-1086 Maintenance - Replace Axios with native fetch API for HTTP re…
Browse files Browse the repository at this point in the history
…quests (#36)

Co-authored-by: Luca <[email protected]>
  • Loading branch information
lucaspinosi and Luca authored Jan 29, 2024
1 parent 53728d4 commit 414b79f
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 484 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { screen } from '@testing-library/react'
import React from 'react'

import { Navbar } from '@/components/Navbar'
import { renderWithWrappers } from '@/__tests__/functions'
import { renderWithWrappers } from '../functions'

const setup = () => renderWithWrappers(<Navbar />)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@jest/globals'
import { screen, fireEvent } from '@testing-library/react'
import React from 'react'

import { renderWithWrappers } from '@/__tests__/functions'
import { renderWithWrappers } from '../functions'
import { ThemeSwitch } from '@/components/ThemeSwitch'

const setup = () => renderWithWrappers(<ThemeSwitch />)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { expect } from '@jest/globals'
import { pactWith } from 'jest-pact/dist/v3'

import { HTTPMethod } from '@/__tests__/pact/utils'
import pactConfig from '@/__tests__/pact/pact.config'

import { axios, withApiOptions } from '@/utils/api/axios'

const healthCheck = withApiOptions<{ status: string }>(({ baseUrl }) => {
return axios.get(`${baseUrl}/api/health/`)
})
import { HTTPMethod } from '../utils'
import pactConfig from '../pact.config'

pactWith(pactConfig, interaction => {
const interactionName = 'A health check request'
Expand All @@ -27,11 +21,9 @@ pactWith(pactConfig, interaction => {
})
})
execute(interactionName, async mockServer => {
const { data, status } = await healthCheck({
baseUrl: mockServer.url
})
const { body, status } = await fetch(`${mockServer.url}/api/health/`)
expect(status).toBe(204)
expect(data).toEqual('')
expect(body).toEqual('')
})
})
})
Loading

0 comments on commit 414b79f

Please sign in to comment.