From df09c952def8eae4df13b6a0df17b3217eb13c2c Mon Sep 17 00:00:00 2001 From: maze Date: Tue, 10 Mar 2026 18:12:42 +0100 Subject: [PATCH] Move tests to their own folder --- {src => test}/crypto.test.ts | 4 ++-- {src => test}/identity.test.ts | 8 ++++---- {src => test}/packet.test.ts | 6 +++--- {src => test}/parser.test.ts | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) rename {src => test}/crypto.test.ts (98%) rename {src => test}/identity.test.ts (98%) rename {src => test}/packet.test.ts (98%) rename {src => test}/parser.test.ts (99%) diff --git a/src/crypto.test.ts b/test/crypto.test.ts similarity index 98% rename from src/crypto.test.ts rename to test/crypto.test.ts index d4e4d3c..0dc5e8f 100644 --- a/src/crypto.test.ts +++ b/test/crypto.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect } from 'vitest'; -import { PublicKey, PrivateKey, SharedSecret, StaticSecret } from './crypto'; -import { bytesToHex, hexToBytes } from './parser'; +import { PublicKey, PrivateKey, SharedSecret, StaticSecret } from '../src/crypto'; +import { bytesToHex, hexToBytes } from '../src/parser'; const randomBytes = (len: number) => Uint8Array.from({ length: len }, () => Math.floor(Math.random() * 256)); diff --git a/src/identity.test.ts b/test/identity.test.ts similarity index 98% rename from src/identity.test.ts rename to test/identity.test.ts index e07a28b..cd585d2 100644 --- a/src/identity.test.ts +++ b/test/identity.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect, beforeEach } from 'vitest'; -import { Identity, LocalIdentity, Contact, Group, Contacts, parseNodeHash } from './identity'; -import { PrivateKey, PublicKey, SharedSecret } from './crypto'; -import { DecryptedGroupText, DecryptedGroupData } from './packet.types'; -import { bytesToHex } from './parser'; +import { Identity, LocalIdentity, Contact, Group, Contacts, parseNodeHash } from '../src/identity'; +import { PrivateKey, PublicKey, SharedSecret } from '../src/crypto'; +import { DecryptedGroupText, DecryptedGroupData } from '../src/packet.types'; +import { bytesToHex } from '../src/parser'; function randomBytes(len: number) { return Uint8Array.from({ length: len }, () => Math.floor(Math.random() * 256)); diff --git a/src/packet.test.ts b/test/packet.test.ts similarity index 98% rename from src/packet.test.ts rename to test/packet.test.ts index 56dd728..584893b 100644 --- a/src/packet.test.ts +++ b/test/packet.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest'; -import { Packet } from './packet'; -import { PayloadType, RouteType, NodeType, TracePayload, AdvertPayload, RequestPayload, TextPayload, ResponsePayload, RawCustomPayload, AnonReqPayload } from './packet.types'; -import { hexToBytes, bytesToHex } from './parser'; +import { Packet } from '../src/packet'; +import { PayloadType, RouteType, NodeType, TracePayload, AdvertPayload, RequestPayload, TextPayload, ResponsePayload, RawCustomPayload, AnonReqPayload } from '../src/packet.types'; +import { hexToBytes, bytesToHex } from '../src/parser'; describe('Packet.fromBytes', () => { test('frame 1: len=122 type=5 payload_len=99', () => { diff --git a/src/parser.test.ts b/test/parser.test.ts similarity index 99% rename from src/parser.test.ts rename to test/parser.test.ts index 5f7abd2..e77662a 100644 --- a/src/parser.test.ts +++ b/test/parser.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { base64ToBytes, hexToBytes, BufferReader, BufferWriter } from './parser'; +import { base64ToBytes, hexToBytes, BufferReader, BufferWriter } from '../src/parser'; describe('base64ToBytes', () => { it('decodes a simple base64 string', () => {