test: add comprehensive testing infrastructure with critical bug fixes

- Add Vitest testing framework with 88 passing tests across 4 test files
- Fix critical entity validator bug (service array index)
- Implement validator architecture with 'matched but invalid' state support
- Add strict IPv4/IPv6 validation with detailed error messages
- Add case-insensitive domain and ASN matching
- Add explicit validator priority ordering (url→json→tld→ip→domain)
- Add integration tests with real IANA registry validation
- Add AutnumCard component for AS number display
- Update dependencies: prettier 2.8.1→2.8.8

Test coverage:
- helpers.test.ts: IPv4/IPv6 CIDR matching (27 tests)
- helpers.asn.test.ts: ASN range validation (22 tests)
- rdap.test.ts: Type detection with edge cases (36 tests)
- rdap.integration.test.ts: Real IANA registry tests (3 tests)

Bug fixes:
- Entity validator now correctly uses service[1] for tags (0=email, 1=tags, 2=urls)
- IPv4 validation rejects octets >255 with specific error messages
- IPv6 validation checks for invalid hex chars and multiple ::
- Domain regex supports multi-label domains (a.b.c.d.example.net)
- Type detection priority prevents URL/JSON false matches as domains
This commit is contained in:
2025-10-22 01:23:15 -05:00
parent 09cd0bf49b
commit 5fb095a498
27 changed files with 4559 additions and 1745 deletions

View File

@@ -25,6 +25,7 @@ In more simpler terms, it's a tool that lets you look up information about IP ad
The tool hosted by [rdap.org](https://client.rdap.org) is fantastic, but it's too simple, and isn't as overly-complicated and annoying as I want it to be. So, I built my own. Mine has dark mode.
But in all seriousness, my project does intend to have more features:
- Proxying: Some RDAP servers are inaccessible over the browser, and so proxying requests through a server is necessary.
- Self Hosting: For those worried about privacy, the project can be self-hosted.
- No Tracking: The project can't track you, because it's a static site. And in terms of the proxy, you can self-host if you're worried about that.
@@ -43,4 +44,4 @@ But in all seriousness, my project does intend to have more features:
[rdap]: https://rdap.xevion.dev
[nextjs]: https://nextjs.org
[nodejs]: https://nodejs.org
[yarn]: https://yarnpkg.com
[yarn]: https://yarnpkg.com