classroom/tests/api_spec.lua

21 lines
731 B
Lua

_G.classroom = {}
require("api")
describe("classroom", function()
it("groups", function()
assert.is_nil(classroom.get_group("test"))
classroom.create_group("test")
assert.is_not_nil(classroom.get_group("test"))
assert.equals(0, #classroom.get_group("test").students)
classroom.add_student_to_group("test", "user1")
assert.equals(1, #classroom.get_group("test").students)
classroom.add_student_to_group("test", "user1")
assert.equals(1, #classroom.get_group("test").students)
classroom.remove_student_from_group("test", "user2")
assert.equals(1, #classroom.get_group("test").students)
classroom.remove_student_from_group("test", "user1")
assert.equals(0, #classroom.get_group("test").students)
end)
end)