import { InternalService, Microservice } from "../../src";

class MockMicroservice extends Microservice {
	public readonly customProp: string = "Test property";
}
class MockInternalService<M extends Microservice> extends InternalService<M> { NAME = "Test"; }

describe("InternalService", () => {
	test("Get owning microservice instance", () => {
		let microservice = new Microservice();
		let service = new MockInternalService(microservice);
		expect(service.microservice).toBeInstanceOf(Microservice);
	});

	test("Access properties from custom microservices", () => {
		let microservice = new MockMicroservice();
		let service = new MockInternalService<MockMicroservice>(microservice);
		expect(service.microservice.customProp).toEqual("Test property");
	});
});
