import { assertEquals, assertThrows } from 'jsr:@std/assert';
import { Admin, MathUtil, Person, User } from './classes.ts';

Deno.test('User Klasse', () => {
  const user = new User('Charly', 'charly@mail.com');
  assertEquals(user.getInfo(), 'Charly (charly@mail.com)');
});

Deno.test('Admin Klasse', () => {
  const admin = new Admin('Emil', 'emil@mail.com', 'admin');
  assertEquals(admin.getInfo(), 'Emil (emil@mail.com), admin');
  assertEquals(admin.role, 'admin');
});

Deno.test('MathUtil Klasse', () => {
  const excptected = 78.53975;
  const actual = MathUtil.circleArea(5);

  assertEquals(actual, excptected);
});

Deno.test('Person Klasse', () => {
  const person = new Person(30);
  assertEquals(person.age, 30);

  person.age = 40;
  assertEquals(person.age, 40);

  assertThrows(() => {
    person.age = -1;
  }, Error);
});
