diff --git a/Makefile b/Makefile index 8b36344..10113ea 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,8 @@ endif .PHONY: help dev-cli prod-cli \ dev-up dev-down dev-up-rebuild \ - prod-up prod-down prod-up-rebuild + prod-up prod-down prod-up-rebuild \ + test test-watch test-coverage help: @echo "Available targets:" @@ -23,6 +24,9 @@ help: @echo " make prod-up # docker compose --profile prod up -d" @echo " make prod-up-rebuild # docker compose --profile prod up -d --build" @echo " make prod-down # docker compose --profile prod down" + @echo " make test # Run backend tests" + @echo " make test-watch # Run backend tests in watch mode" + @echo " make test-coverage # Run backend tests with coverage report" @echo "Notes: GNU Make nie wspiera subkomend z odstępami (np. 'make prod up')." @echo " Użyj odpowiednich celów z myślnikiem." @@ -52,3 +56,13 @@ prod-up-rebuild: prod-down: $(COMPOSE) --profile prod down + +# Tests +test: + $(COMPOSE) exec $(BACKEND_SVC) npm test + +test-watch: + $(COMPOSE) exec $(BACKEND_SVC) npm run test:watch + +test-coverage: + $(COMPOSE) exec $(BACKEND_SVC) npm test -- --coverage diff --git a/backend/src/__tests__/auth.test.js b/backend/src/__tests__/auth.test.js index 2c6a1ef..c30ba2d 100644 --- a/backend/src/__tests__/auth.test.js +++ b/backend/src/__tests__/auth.test.js @@ -27,7 +27,7 @@ describe('Authentication API Tests', () => { .expect(201); expect(response.body).toHaveProperty('success', true); - expect(response.body).toHaveProperty('message', 'User registered successfully'); + expect(response.body).toHaveProperty('message', 'User registered successfully. Please check your email to verify your account.'); expect(response.body.data).toHaveProperty('user'); expect(response.body.data).toHaveProperty('token'); expect(response.body.data.user).toHaveProperty('id'); @@ -49,7 +49,7 @@ describe('Authentication API Tests', () => { .expect(400); expect(response.body).toHaveProperty('success', false); - expect(response.body).toHaveProperty('error', 'Email already registered'); + expect(response.body).toHaveProperty('error', 'An account with these credentials already exists. Please try logging in or use different credentials.'); }); it('should reject registration with duplicate username', async () => { @@ -64,7 +64,7 @@ describe('Authentication API Tests', () => { .expect(400); expect(response.body).toHaveProperty('success', false); - expect(response.body).toHaveProperty('error', 'Username already taken'); + expect(response.body).toHaveProperty('error', 'An account with these credentials already exists. Please try logging in or use different credentials.'); }); it('should reject registration with invalid email', async () => {