local e=require(script.Parent.deserializeDirectory)return function()describe("\085\110\099\104\097\110\103\101\100",function()it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097\110 \101\109\112\116\121 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \103\105\118\101\110 \116\119\111 \101\109\112\116\121 \100\105\114\101\099\116\111\114\105\101\115",function()local Q=e({},{});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.managed))).to.equal(nil);(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.equal(nil)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097\110 \101\109\112\116\121 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \103\105\118\101\110 \116\119\111 \105\100\101\110\116\105\099\097\108 \100\105\114\101\099\116\111\114\105\101\115",function()local Q=e({flag={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}},{flag={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.managed))).to.equal(nil);(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.equal(nil)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097\110 \101\109\112\116\121 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \103\105\118\101\110 \116\119\111 \105\100\101\110\116\105\099\097\108 \100\105\114\101\099\116\111\114\105\101\115 \119\105\116\104 \109\097\110\121 \102\108\097\103\115",function()local Q=e({flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1};flag2={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1};flag3={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1},flag4={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1};flag5={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}},{flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag2={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag3={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag4={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag5={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.managed))).to.equal(nil);(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.equal(nil)end)end)describe("\082\101\109\111\118\097\108",function()it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \114\101\109\111\118\097\108\115 \119\104\101\110 \103\105\118\101\110 \097 \100\105\114\101\099\116\111\114\121 \119\105\116\104 \097 \102\108\097\103 \114\101\109\111\118\101\100",function()local Q=e({flag={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}},{});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.managed))).to.equal(nil);(expect(next(Q.user))).to.equal(nil);(expect(Q.removed.flag)).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \114\101\109\111\118\097\108\115 \119\104\101\110 \103\105\118\101\110 \097 \100\105\114\101\099\116\111\114\121 \119\105\116\104 \109\097\110\121 \102\108\097\103\115 \114\101\109\111\118\101\100",function()local Q=e({flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag2={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag3={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag4={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag5={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1}},{flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1},flag2={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.managed))).to.equal(nil);(expect(next(Q.user))).to.equal(nil);(expect(Q.removed.flag3)).to.equal(true);(expect(Q.removed.flag4)).to.equal(true);(expect(Q.removed.flag5)).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \114\101\109\111\118\097\108\115 \119\104\101\110 \115\111\109\101 \102\108\097\103\115 \104\097\118\101 \099\104\097\110\103\101\100",function()local Q=e({flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1};flag2={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1};flag3={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1},flag4={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1};flag5={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1}},{flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=2};flag2={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=2}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.managed))).to.ok();(expect(next(Q.user))).to.equal(nil);(expect(Q.removed.flag3)).to.equal(true);(expect(Q.removed.flag4)).to.equal(true);(expect(Q.removed.flag5)).to.equal(true)end)end)describe("\085\112\100\097\116\101\115",function()it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \103\105\118\101\110 \097 \100\105\114\101\099\116\111\114\121 \119\105\116\104 \097 \102\108\097\103 \097\100\100\101\100",function()local Q=e({},{flag={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.equal(nil);(expect(Q.managed.TestRepository)).to.be.a("\116\097\098\108\101");(expect(Q.managed.TestRepository.flag)).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \103\105\118\101\110 \097 \100\105\114\101\099\116\111\114\121 \119\105\116\104 \109\097\110\121 \102\108\097\103\115 \097\100\100\101\100",function()local Q=e({},{flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1};flag2={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1},flag3={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag4={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1},flag5={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.equal(nil);(expect(Q.managed.TestRepository)).to.be.a("\116\097\098\108\101");(expect(Q.managed.TestRepository.flag1)).to.equal(1);(expect(Q.managed.TestRepository.flag2)).to.equal(1);(expect(Q.managed.TestRepository.flag3)).to.equal(1);(expect(Q.managed.TestRepository.flag4)).to.equal(1);(expect(Q.managed.TestRepository.flag5)).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \103\105\118\101\110 \097 \100\105\114\101\099\116\111\114\121 \119\105\116\104 \097 \102\108\097\103 \099\104\097\110\103\101\100",function()local Q=e({flag={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1}},{flag={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=2}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.equal(nil);(expect(Q.managed.TestRepository)).to.be.a("\116\097\098\108\101");(expect(Q.managed.TestRepository.flag)).to.equal(2)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \097 \103\105\118\101\110 \097 \100\105\114\101\099\116\111\114\121 \119\105\116\104 \109\097\110\121 \102\108\097\103\115 \099\104\097\110\103\101\100",function()local Q=e({flag1={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag2={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1};flag3={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag4={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag5={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1}},{flag1={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=2},flag2={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=2},flag3={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=2},flag4={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1};flag5={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.equal(nil);(expect(Q.managed.TestRepository)).to.be.a("\116\097\098\108\101");(expect(Q.managed.TestRepository.flag1)).to.equal(2);(expect(Q.managed.TestRepository.flag2)).to.equal(2);(expect(Q.managed.TestRepository.flag3)).to.equal(2)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \115\101\116 \111\102 \117\112\100\097\116\101\115 \119\104\101\110 \102\108\097\103\115 \097\114\101 \114\101\109\111\118\101\100",function()local Q=e({flag1={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1};flag2={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1};flag3={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1},flag4={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121";version=1};flag5={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=1}},{flag1={managed=true,repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=2},flag2={managed=true;repository="\084\101\115\116\082\101\112\111\115\105\116\111\114\121",version=2}});(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q.managed)).to.be.a("\116\097\098\108\101");(expect(Q.user)).to.be.a("\116\097\098\108\101");(expect(Q.removed)).to.be.a("\116\097\098\108\101");(expect(next(Q.user))).to.equal(nil);(expect(next(Q.removed))).to.ok();(expect(Q.managed.TestRepository)).to.be.a("\116\097\098\108\101");(expect(Q.managed.TestRepository.flag1)).to.equal(2);(expect(Q.managed.TestRepository.flag2)).to.equal(2)end)end)end
local deserializeDirectory = require(script.Parent.deserializeDirectory)

return function()
	describe("Unchanged", function()
		it("should return an empty set of updates when given two empty directories", function()
			local updates = deserializeDirectory({}, {})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.managed))).to.equal(nil)
			expect((next(updates.user))).to.equal(nil)
			expect((next(updates.removed))).to.equal(nil)
		end)

		it("should return an empty set of updates when given two identical directories", function()
			local updates = deserializeDirectory({
				["flag"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			}, {
				["flag"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.managed))).to.equal(nil)
			expect((next(updates.user))).to.equal(nil)
			expect((next(updates.removed))).to.equal(nil)
		end)

		it(
			"should return an empty set of updates when given two identical directories with many flags",
			function()
				local updates = deserializeDirectory({
					["flag1"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag2"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag3"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag4"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag5"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
				}, {
					["flag1"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag2"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag3"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag4"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag5"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
				})

				expect(updates).to.be.a("table")
				expect(updates.managed).to.be.a("table")
				expect(updates.user).to.be.a("table")
				expect(updates.removed).to.be.a("table")

				expect((next(updates.managed))).to.equal(nil)
				expect((next(updates.user))).to.equal(nil)
				expect((next(updates.removed))).to.equal(nil)
			end
		)
	end)

	describe("Removal", function()
		it("should return a set of removals when given a directory with a flag removed", function()
			local updates = deserializeDirectory({
				["flag"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			}, {})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.managed))).to.equal(nil)
			expect((next(updates.user))).to.equal(nil)

			expect(updates.removed["flag"]).to.equal(true)
		end)

		it(
			"should return a set of removals when given a directory with many flags removed",
			function()
				local updates = deserializeDirectory({
					["flag1"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag2"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag3"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag4"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag5"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
				}, {
					["flag1"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag2"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
				})

				expect(updates).to.be.a("table")
				expect(updates.managed).to.be.a("table")
				expect(updates.user).to.be.a("table")
				expect(updates.removed).to.be.a("table")

				expect((next(updates.managed))).to.equal(nil)
				expect((next(updates.user))).to.equal(nil)

				expect(updates.removed["flag3"]).to.equal(true)
				expect(updates.removed["flag4"]).to.equal(true)
				expect(updates.removed["flag5"]).to.equal(true)
			end
		)

		it("should return a set of removals when some flags have changed", function()
			local updates = deserializeDirectory({
				["flag1"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag2"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag3"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag4"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag5"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			}, {
				["flag1"] = {
					managed = true,
					repository = "TestRepository",
					version = 2,
				},
				["flag2"] = {
					managed = true,
					repository = "TestRepository",
					version = 2,
				},
			})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.managed))).to.ok()
			expect((next(updates.user))).to.equal(nil)

			expect(updates.removed["flag3"]).to.equal(true)
			expect(updates.removed["flag4"]).to.equal(true)
			expect(updates.removed["flag5"]).to.equal(true)
		end)
	end)

	describe("Updates", function()
		it("should return a set of updates when given a directory with a flag added", function()
			local updates = deserializeDirectory({}, {
				["flag"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.user))).to.equal(nil)
			expect((next(updates.removed))).to.equal(nil)

			expect(updates.managed["TestRepository"]).to.be.a("table")
			expect(updates.managed["TestRepository"]["flag"]).to.equal(1)
		end)

		it("should return a set of updates when given a directory with many flags added", function()
			local updates = deserializeDirectory({}, {
				["flag1"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag2"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag3"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag4"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag5"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.user))).to.equal(nil)
			expect((next(updates.removed))).to.equal(nil)

			expect(updates.managed["TestRepository"]).to.be.a("table")
			expect(updates.managed["TestRepository"]["flag1"]).to.equal(1)
			expect(updates.managed["TestRepository"]["flag2"]).to.equal(1)
			expect(updates.managed["TestRepository"]["flag3"]).to.equal(1)
			expect(updates.managed["TestRepository"]["flag4"]).to.equal(1)
			expect(updates.managed["TestRepository"]["flag5"]).to.equal(1)
		end)

		it("should return a set of updates when given a directory with a flag changed", function()
			local updates = deserializeDirectory({
				["flag"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			}, {
				["flag"] = {
					managed = true,
					repository = "TestRepository",
					version = 2,
				},
			})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.user))).to.equal(nil)
			expect((next(updates.removed))).to.equal(nil)

			expect(updates.managed["TestRepository"]).to.be.a("table")
			expect(updates.managed["TestRepository"]["flag"]).to.equal(2)
		end)

		it(
			"should return a set of updates when a given a directory with many flags changed",
			function()
				local updates = deserializeDirectory({
					["flag1"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag2"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag3"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag4"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag5"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
				}, {
					["flag1"] = {
						managed = true,
						repository = "TestRepository",
						version = 2,
					},
					["flag2"] = {
						managed = true,
						repository = "TestRepository",
						version = 2,
					},
					["flag3"] = {
						managed = true,
						repository = "TestRepository",
						version = 2,
					},
					["flag4"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
					["flag5"] = {
						managed = true,
						repository = "TestRepository",
						version = 1,
					},
				})

				expect(updates).to.be.a("table")
				expect(updates.managed).to.be.a("table")
				expect(updates.user).to.be.a("table")
				expect(updates.removed).to.be.a("table")

				expect((next(updates.user))).to.equal(nil)
				expect((next(updates.removed))).to.equal(nil)

				expect(updates.managed["TestRepository"]).to.be.a("table")
				expect(updates.managed["TestRepository"]["flag1"]).to.equal(2)
				expect(updates.managed["TestRepository"]["flag2"]).to.equal(2)
				expect(updates.managed["TestRepository"]["flag3"]).to.equal(2)
			end
		)

		it("should return a set of updates when flags are removed", function()
			local updates = deserializeDirectory({
				["flag1"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag2"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag3"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag4"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
				["flag5"] = {
					managed = true,
					repository = "TestRepository",
					version = 1,
				},
			}, {
				["flag1"] = {
					managed = true,
					repository = "TestRepository",
					version = 2,
				},
				["flag2"] = {
					managed = true,
					repository = "TestRepository",
					version = 2,
				},
			})

			expect(updates).to.be.a("table")
			expect(updates.managed).to.be.a("table")
			expect(updates.user).to.be.a("table")
			expect(updates.removed).to.be.a("table")

			expect((next(updates.user))).to.equal(nil)
			expect((next(updates.removed))).to.ok()

			expect(updates.managed["TestRepository"]).to.be.a("table")
			expect(updates.managed["TestRepository"]["flag1"]).to.equal(2)
			expect(updates.managed["TestRepository"]["flag2"]).to.equal(2)
		end)
	end)
end
