Fix tests

This commit is contained in:
dangered wolf 2024-08-04 10:51:31 -07:00
parent ac32c0a863
commit bfbd102cc3
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
2 changed files with 5 additions and 5 deletions

View file

@ -134,6 +134,6 @@ export const statusRequest = async (c: Context) => {
Obviously we just need to redirect to the status directly.*/
console.log('Matched human UA', userAgent);
return c.redirect(`${baseUrl}/${handle || 'i'}/status/${id?.match(/\d{2,20}/)?.[0]}`, 302);
return c.redirect(`${baseUrl}/${handle || 'i'}/status/${id?.match(/\d{2,20}/)?.[0]}?mx=1`, 302);
}
};

View file

@ -55,7 +55,7 @@ test('Status redirect human', async () => {
})
);
expect(result.status).toEqual(302);
expect(result.headers.get('location')).toEqual('https://twitter.com/jack/status/20');
expect(result.headers.get('location')).toEqual('https://twitter.com/jack/status/20?mx=1');
});
test('Status redirect human trailing slash', async () => {
@ -66,7 +66,7 @@ test('Status redirect human trailing slash', async () => {
})
);
expect(result.status).toEqual(302);
expect(result.headers.get('location')).toEqual('https://twitter.com/jack/status/20');
expect(result.headers.get('location')).toEqual('https://twitter.com/jack/status/20?mx=1');
});
test('Status redirect human custom base redirect', async () => {
@ -80,7 +80,7 @@ test('Status redirect human custom base redirect', async () => {
})
);
expect(result.status).toEqual(302);
expect(result.headers.get('location')).toEqual('https://nitter.net/jack/status/20');
expect(result.headers.get('location')).toEqual('https://nitter.net/jack/status/20?mx=1');
});
test('Twitter moment redirect', async () => {
@ -94,7 +94,7 @@ test('Twitter moment redirect', async () => {
)
);
expect(result.status).toEqual(302);
expect(result.headers.get('location')).toEqual(`${twitterBaseUrl}/i/events/1572638642127966214`);
expect(result.headers.get('location')).toEqual(`${twitterBaseUrl}/i/events/1572638642127966214?mx=1`);
});
test('Status response robot', async () => {