Skip to content

Commit d37e626

Browse files
committed
remove test implementations that don't actually test the described feature
`fetch` API doesn't allow sending a body with GET requests
1 parent 65e64c8 commit d37e626

File tree

5 files changed

+6
-61
lines changed

5 files changed

+6
-61
lines changed

tests/custom.test.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,6 @@ test('should parse custom body', async () => {
2525
}).expect(200, 'HELLO WORLD')
2626
})
2727

28-
test('custom should ignore GET request', async () => {
29-
const server = createServer(async (req: Request, res) => {
30-
const body = await custom(req, res)
31-
32-
res.setHeader('Content-Type', 'text/plain')
33-
34-
res.end(body == null ? 'GET is ignored' : 'GET is not ignored')
35-
})
28+
test.skip('custom should ignore GET request', async () => {
3629

37-
await makeFetch(server)('/', {
38-
method: 'GET',
39-
headers: {
40-
Accept: 'text/plain',
41-
'Content-Type': 'text/plain',
42-
},
43-
}).expect(200, 'GET is ignored')
4430
})

tests/json.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,8 @@ it('should not parse json body with no content-type headers', async () => {
108108
await expect(response.text()).resolves.toEqual('')
109109
})
110110

111-
it('should ignore GET requests', async () => {
112-
const fetch = createFetch()
113-
const response = await fetch({
114-
method: 'GET',
115-
})
116-
expect(response.status).toBe(200)
117-
await expect(response.text()).resolves.toEqual('')
111+
it.skip('should ignore GET requests', async () => {
112+
118113
})
119114

120115
describe('with invalid JSON body', () => {

tests/raw.test.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,6 @@ test('should parse raw body', async () => {
2525
}).expect(200, 'hello world')
2626
})
2727

28-
test('raw should ignore GET request', async () => {
29-
const server = createServer(async (req: Request, res) => {
30-
const body = await raw(req, res)
31-
32-
res.setHeader('Content-Type', 'text/plain')
33-
34-
res.end('GET is ignored')
35-
})
28+
test.skip('raw should ignore GET request', async () => {
3629

37-
await makeFetch(server)('/', {
38-
method: 'GET',
39-
headers: {
40-
Accept: 'text/plain',
41-
'Content-Type': 'text/plain',
42-
},
43-
}).expect(200, 'GET is ignored')
4430
})

tests/text.test.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,6 @@ test('should parse text body', async () => {
2525
}).expect(200, 'hello world')
2626
})
2727

28-
test('text should ignore GET request', async () => {
29-
const server = createServer(async (req: Request, res) => {
30-
await text(req, res)
31-
32-
res.setHeader('Content-Type', 'text/plain')
33-
34-
res.end('GET is ignored')
35-
})
28+
test.skip('text should ignore GET request', async () => {
3629

37-
await makeFetch(server)('/', {
38-
method: 'GET',
39-
headers: {
40-
Accept: 'text/plain',
41-
'Content-Type': 'text/plain',
42-
},
43-
}).expect(200, 'GET is ignored')
4430
})

tests/urlencoded.test.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ test('should parse urlencoded body', async () => {
2525
}).expect(200, { hello: 'world' })
2626
})
2727

28-
test('urlencoded should ignore GET request', async () => {
29-
const server = createServer(async (req: Request, res) => {
30-
const body = await urlencoded(req, res)
28+
test.skip('urlencoded should ignore GET request', async () => {
3129

32-
res.end('GET is ignored')
33-
})
34-
35-
await makeFetch(server)('/', {
36-
method: 'GET',
37-
}).expect(200, 'GET is ignored')
3830
})

0 commit comments

Comments
 (0)