mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-19 03:14:00 +01:00
Add tests for routes with trailing slashes (prevent #480 incident again)
This commit is contained in:
parent
d33eb226b1
commit
0e4f17d279
1 changed files with 21 additions and 0 deletions
|
@ -58,6 +58,17 @@ test('Tweet redirect human', async () => {
|
||||||
expect(result.headers.get('location')).toEqual('https://twitter.com/jack/status/20');
|
expect(result.headers.get('location')).toEqual('https://twitter.com/jack/status/20');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Tweet redirect human trailing slash', async () => {
|
||||||
|
const result = await app.request(
|
||||||
|
new Request('https://fxtwitter.com/jack/status/20/', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: humanHeaders
|
||||||
|
})
|
||||||
|
);
|
||||||
|
expect(result.status).toEqual(302);
|
||||||
|
expect(result.headers.get('location')).toEqual('https://twitter.com/jack/status/20');
|
||||||
|
});
|
||||||
|
|
||||||
test('Tweet redirect human custom base redirect', async () => {
|
test('Tweet redirect human custom base redirect', async () => {
|
||||||
const result = await app.request(
|
const result = await app.request(
|
||||||
new Request('https://fxtwitter.com/jack/status/20', {
|
new Request('https://fxtwitter.com/jack/status/20', {
|
||||||
|
@ -96,6 +107,16 @@ test('Tweet response robot', async () => {
|
||||||
expect(result.status).toEqual(200);
|
expect(result.status).toEqual(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Tweet response robot (trailing slash/query string)', async () => {
|
||||||
|
const result = await app.request(
|
||||||
|
new Request('https://fxtwitter.com/jack/status/20/?asdf=ghjk&klop;', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: botHeaders
|
||||||
|
})
|
||||||
|
);
|
||||||
|
expect(result.status).toEqual(200);
|
||||||
|
});
|
||||||
|
|
||||||
test('API fetch basic Tweet', async () => {
|
test('API fetch basic Tweet', async () => {
|
||||||
const result = await app.request(
|
const result = await app.request(
|
||||||
new Request('https://api.fxtwitter.com/status/20', {
|
new Request('https://api.fxtwitter.com/status/20', {
|
||||||
|
|
Loading…
Add table
Reference in a new issue