artmapper-test-app-ts
v1.0.0
Published
TypeScript test application for ArtMapper framework
Readme
ArtMapper TypeScript Test Application
Comprehensive TypeScript test application to verify all ArtMapper features work correctly.
Features Tested
✅ All MySQL Data Types:
- ENUM types with custom values
- BOOLEAN/BOOL types (TINYINT(1))
- SET types with multiple values
- JSON type for metadata
- DECIMAL with precision/scale
- UNSIGNED integers
- BLOB types
- All text types
- Timestamps with ON UPDATE
✅ Framework Features:
- Entity decorators with full TypeScript support
- Repository pattern
- Service layer
- REST controllers with parameter decorators
- Dependency injection
- Auto schema generation
- Query builder
Setup
- Install dependencies:
cd test-app-ts
npm install- Configure database (create
.envfile or set environment variables):
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=artmapper_test_ts- Start the application:
npm run dev- Run tests (in another terminal):
npm testTest Endpoints
Users API
GET /api/users- Get all usersGET /api/users?status=ACTIVE- Get users by status (ENUM)GET /api/users/:id- Get user by IDPOST /api/users- Create userPUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
Products API
GET /api/products- Get all productsGET /api/products?category=ELECTRONICS- Get products by category (ENUM)GET /api/products?featured=true- Get featured products (BOOLEAN)GET /api/products/price-range?min=0&max=100- Get products by price range (DECIMAL)GET /api/products/:id- Get product by IDPOST /api/products- Create productPUT /api/products/:id- Update productDELETE /api/products/:id- Delete product
Example Requests
Create User with all data types:
curl -X POST http://localhost:3002/api/users \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"email": "[email protected]",
"password": "password123",
"status": "ACTIVE",
"isVerified": true,
"age": 25,
"balance": 100.50,
"metadata": {"preferences": {"theme": "dark"}},
"tags": ["PREMIUM", "VIP"]
}'Create Product with all data types:
curl -X POST http://localhost:3002/api/products \
-H "Content-Type: application/json" \
-d '{
"name": "Test Product",
"description": "A test product",
"category": "ELECTRONICS",
"price": 99.99,
"stock": 100,
"isFeatured": true,
"isActive": true,
"rating": 4.5,
"metadata": {"specs": {"weight": "1kg"}},
"tags": ["NEW", "FEATURED"]
}'Test Results
The test script verifies:
- ✅ User creation with ENUM, BOOLEAN, JSON, SET types
- ✅ Product creation with all MySQL data types
- ✅ Querying by ENUM values
- ✅ Querying by BOOLEAN values
- ✅ Querying by DECIMAL ranges
- ✅ CRUD operations
- ✅ Auto schema generation
- ✅ Parameter decorators (@RequestParam, @PathVariable, @RequestBody)
- ✅ Type safety with TypeScript
- ✅ ENUM value validation
- ✅ BOOLEAN value validation
- ✅ JSON value validation
- ✅ DECIMAL precision validation
Notes
- The application automatically creates the database and tables on startup
- All entities use TypeScript with full type safety
- Parameter decorators work perfectly in TypeScript
- The test demonstrates real-world usage patterns
