import PersonalCardModule from "./personalCard";
import PersonalCardController from "./personalCard.controller";
import PersonalCardComponent from "./personalCard.component";
import PersonalCardTemplate from "./personalCard.html";

describe("PersonalCard", () => {
	let $rootScope, makeController;

	beforeEach(window.module(PersonalCardModule));
	beforeEach(inject((_$rootScope_) => {
		$rootScope = _$rootScope_;
		makeController = () => {
			return new PersonalCardController();
		};
	}));

	describe("Module", () => {
		// top-level specs: i.e., routes, injection, naming
	});

	describe("Controller", () => {
		// controller specs
		it("has a name property [REMOVE]", () => { // erase if removing this.name from the controller
			let controller = makeController();
			expect(controller).to.have.property("name");
		});
	});

	describe("Template", () => {
		// template specs
		// tip: use regex to ensure correct bindings are used e.g., {{  }}
		it("has name in template [REMOVE]", () => {
			expect(PersonalCardTemplate).to.match(/{{\s?\$ctrl\.name\s?}}/g);
		});
	});

	describe("Component", () => {
		// component/directive specs
		let component = PersonalCardComponent;

		it("includes the intended template", () => {
			expect(component.template).to.equal(PersonalCardTemplate);
		});

		it("invokes the right controller", () => {
			expect(component.controller).to.equal(PersonalCardController);
		});
	});
});
