|
1 | 1 | import { describe, expect, it } from 'vitest'; |
2 | | -import { _shouldInstrumentSpans } from '../../src/integrations/http'; |
| 2 | +import { _shouldInstrumentSpans, isStaticAssetRequest } from '../../src/integrations/http'; |
3 | 3 | import { conditionalTest } from '../helpers/conditional'; |
4 | 4 |
|
5 | 5 | describe('httpIntegration', () => { |
@@ -27,4 +27,34 @@ describe('httpIntegration', () => { |
27 | 27 | expect(actual).toBe(true); |
28 | 28 | }); |
29 | 29 | }); |
| 30 | + |
| 31 | + describe('isStaticAssetRequest', () => { |
| 32 | + it.each([ |
| 33 | + ['/favicon.ico', true], |
| 34 | + ['/apple-touch-icon.png', true], |
| 35 | + ['/static/style.css', true], |
| 36 | + ['/assets/app.js', true], |
| 37 | + ['/fonts/font.woff2', true], |
| 38 | + ['/images/logo.svg', true], |
| 39 | + ['/img/photo.jpeg', true], |
| 40 | + ['/img/photo.jpg', true], |
| 41 | + ['/img/photo.jpg?v=123', true], |
| 42 | + ['/img/photo.webp', true], |
| 43 | + ['/font/font.ttf', true], |
| 44 | + ['/robots.txt', true], |
| 45 | + ['/sitemap.xml', true], |
| 46 | + ['/manifest.json', true], |
| 47 | + ['/browserconfig.xml', true], |
| 48 | + // non-static routes |
| 49 | + ['/api/users', false], |
| 50 | + ['/some-json.json', false], |
| 51 | + ['/some-xml.xml', false], |
| 52 | + ['/some-txt.txt', false], |
| 53 | + ['/users', false], |
| 54 | + ['/graphql', false], |
| 55 | + ['/', false], |
| 56 | + ])('returns %s -> %s', (urlPath, expected) => { |
| 57 | + expect(isStaticAssetRequest(urlPath)).toBe(expected); |
| 58 | + }); |
| 59 | + }); |
30 | 60 | }); |
0 commit comments