print(package.path)

package.path = "../?.lua;" .. package.path

_G.defense_mob_api = {library = {}}

require("observer_api")



describe("observer_api", function()
		local do_observers = defense_mob_api.library.set_up_observers("test_observers")
		
		it("sets_up", function()
				assert.equals("function", type(do_observers))
				assert.equals("function", type(defense_mob_api.test_observers))
			end)
			
		it("registers", function()
				local a, b = 0, 0
				
				defense_mob_api.test_observers(function() a = a + 1 end)
				defense_mob_api.test_observers(function() b = b + 1 end)
				do_observers()
				assert.equals(1, a)
				assert.equals(1, b)
			end)
			
		it("passes arguments", function()
				local a = 0
				
				defense_mob_api.test_observers(function(arg) a = arg end)
				local test_argument = 42096
				do_observers(test_argument)
				assert.equals(test_argument, a) 
				
			end)
	end)
