This commit is contained in:
lx
2026-07-06 14:01:11 -04:00
commit c4f97d729d
16468 changed files with 935321 additions and 0 deletions
@@ -0,0 +1,17 @@
local Bundle = {}
function Bundle.fromData(data)
local self = {}
self.assetId = data.id
self.name = data.name
self.description = data.description
self.priceInRobux = data.priceInRobux
self.partIds = data.partIds
self.productId = data.productId
self.creatorId = data.creatorId
return self
end
return Bundle
@@ -0,0 +1,34 @@
--[[
{
creatorId : number,
creatorName : string,
name : string,
universeId : number,
placeId : number,
imageToken : string,
totalUpVotes : number,
totalDownVotes : number,
}
]]
local Game = {}
function Game.new()
local self = {}
return self
end
function Game.fromJsonData(gameJson)
local self = Game.new()
self.creatorId = gameJson.creatorId
self.creatorName = gameJson.creatorName
self.name = gameJson.name
self.universeId = gameJson.universeId
self.placeId = gameJson.placeId
self.imageToken = gameJson.imageToken
self.totalUpVotes = gameJson.totalUpVotes
self.totalDownVotes = gameJson.totalDownVotes
return self
end
return Game
@@ -0,0 +1,31 @@
return function()
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local Game = require(Modules.Shell.Models.Game)
it("should set fields without errors", function()
local testData =
{
creatorId = 531670163,
creatorName = "game creator",
name = "game name",
universeId = 1234567890,
placeId = 9876543210,
imageToken = "_606849621_7a6d13bd9a4ae39a8d0b18737d906829",
totalUpVotes = 9999,
totalDownVotes = 1111,
}
local gameModel = Game.fromJsonData(testData)
expect(gameModel).to.be.a("table")
expect(gameModel.creatorId).to.equal(531670163)
expect(gameModel.creatorName).to.equal("game creator")
expect(gameModel.name).to.equal("game name")
expect(gameModel.universeId).to.equal(1234567890)
expect(gameModel.placeId).to.equal(9876543210)
expect(gameModel.imageToken).to.equal("_606849621_7a6d13bd9a4ae39a8d0b18737d906829")
expect(gameModel.totalUpVotes).to.equal(9999)
expect(gameModel.totalDownVotes).to.equal(1111)
end)
end
@@ -0,0 +1,38 @@
--[[
{
creatorName : string,
name : string,
description : string,
isFavorited : bool,
lastUpdated : string,
creationDate : string,
maxPlayers : number,
isExperimental : bool,
creatorUserId : number,
universeId : number,
}
]]
local GameDetail = {}
function GameDetail.new()
local self = {}
return self
end
function GameDetail.fromJsonData(gameJson)
local self = GameDetail.new()
self.creatorName = gameJson.Builder
self.name = gameJson.Name
self.description = gameJson.Description
self.isFavorited = gameJson.IsFavoritedByUser
self.updated = gameJson.Updated
self.created = gameJson.Created
self.maxPlayers = gameJson.MaxPlayers
self.isExperimental = gameJson.IsExperimental
self.creatorUserId = gameJson.BuilderId
self.universeId = gameJson.UniverseId
return self
end
return GameDetail
@@ -0,0 +1,35 @@
return function()
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local GameDetail = require(Modules.Shell.Models.GameDetail)
it("should set fields without errors", function()
local testData =
{
Builder = "game creator",
Name = "game name",
Description = "This is a game description.",
IsFavoritedByUser = false,
Updated = "12/12/2012",
Created = "11/11/2011",
MaxPlayers = 200,
IsExperimental = false,
BuilderId = 531670163,
UniverseId = 1234567890,
}
local gameDetail = GameDetail.fromJsonData(testData)
expect(gameDetail).to.be.a("table")
expect(gameDetail.creatorName).to.equal("game creator")
expect(gameDetail.name).to.equal("game name")
expect(gameDetail.description).to.equal("This is a game description.")
expect(gameDetail.isFavorited).to.equal(false)
expect(gameDetail.updated).to.equal("12/12/2012")
expect(gameDetail.created).to.equal("11/11/2011")
expect(gameDetail.maxPlayers).to.equal(200)
expect(gameDetail.isExperimental).to.equal(false)
expect(gameDetail.creatorUserId).to.equal(531670163)
expect(gameDetail.universeId).to.equal(1234567890)
end)
end
@@ -0,0 +1,34 @@
--[[
{
creatorId : number,
creatorName : string,
name : string,
universeId : number,
placeId : number,
iconId : number,
totalUpVotes : number,
totalDownVotes : number,
}
]]
local Game = {}
function Game.new()
local self = {}
return self
end
function Game.fromJsonData(gameJson)
local self = Game.new()
self.creatorId = gameJson.CreatorID
self.creatorName = gameJson.CreatorName
self.name = gameJson.Name
self.universeId = gameJson.UniverseID
self.placeId = gameJson.PlaceID
self.iconId = gameJson.ImageId
self.totalUpVotes = gameJson.TotalUpVotes
self.totalDownVotes = gameJson.TotalDownVotes
return self
end
return Game
@@ -0,0 +1,31 @@
return function()
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local GameLegacy = require(Modules.Shell.Models.GameLegacy)
it("should set fields without errors", function()
local testData =
{
CreatorID = 531670163,
CreatorName = "game creator",
Name = "game name",
UniverseID = 1234567890,
PlaceID = 9876543210,
ImageId = 963852741,
TotalUpVotes = 9999,
TotalDownVotes = 1111,
}
local gameModel = GameLegacy.fromJsonData(testData)
expect(gameModel).to.be.a("table")
expect(gameModel.creatorId).to.equal(531670163)
expect(gameModel.creatorName).to.equal("game creator")
expect(gameModel.name).to.equal("game name")
expect(gameModel.universeId).to.equal(1234567890)
expect(gameModel.placeId).to.equal(9876543210)
expect(gameModel.iconId).to.equal(963852741)
expect(gameModel.totalUpVotes).to.equal(9999)
expect(gameModel.totalDownVotes).to.equal(1111)
end)
end
@@ -0,0 +1,29 @@
--[[
{
creatorId : number,
creatorName : string,
name : string,
placeId : number,
iconId : number,
}
]]
local RecommendedGame = {}
function RecommendedGame.new()
local self = {}
return self
end
--TODO: Clean up useNewApi
function RecommendedGame.fromJsonData(gameJson)
local self = RecommendedGame.new()
self.creatorId = gameJson.Creator and gameJson.Creator.CreatorTargetId
self.creatorName = gameJson.Creator and gameJson.Creator.CreatorName
self.name = gameJson.GameName
self.placeId = gameJson.PlaceId
self.iconId = gameJson.ImageId
return self
end
return RecommendedGame
@@ -0,0 +1,27 @@
return function()
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local RecommendedGame = require(Modules.Shell.Models.RecommendedGame)
it("should set fields without errors", function()
local testData =
{
Creator =
{
CreatorTargetId = 531670163,
CreatorName = "game creator",
},
GameName = "game name",
PlaceId = 9876543210,
ImageId = 963852741,
}
local gameModel = RecommendedGame.fromJsonData(testData)
expect(gameModel).to.be.a("table")
expect(gameModel.creatorName).to.equal("game creator")
expect(gameModel.name).to.equal("game name")
expect(gameModel.placeId).to.equal(9876543210)
expect(gameModel.iconId).to.equal(963852741)
end)
end
@@ -0,0 +1,21 @@
local ScreenItem = {}
ScreenItem.Priority = {
Default = 1,
Overlay = 2,
Elevated = 3,
Immediate = 4,
}
function ScreenItem.new(id, priority, data)
local self = {}
self.id = id
self.priority = priority
self.createdAt = tick()
self.data = data
return self
end
return ScreenItem
@@ -0,0 +1,17 @@
return function()
local ScreenItem = require(script.Parent.ScreenItem)
it("should create without errors", function()
ScreenItem.new("foo", 1, {})
end)
it("should set fields without errors", function()
local screenItem = ScreenItem.new("foo", 1, {})
expect(screenItem).to.be.a("table")
expect(screenItem.id).to.equal("foo")
expect(screenItem.priority).to.equal(1)
expect(screenItem.data).to.be.a("table")
expect(screenItem.createdAt).to.be.a("number")
end)
end
@@ -0,0 +1,28 @@
--[[
{
upVotes : number ,
downVotes : number ,
userVote : bool or nil,
canVote : bool ,
cantVoteReason : string ,
}
]]
local VoteData = {}
function VoteData.new()
local self = {}
return self
end
function VoteData.fromJsonData(voteJson)
local self = VoteData.new()
self.upVotes = voteJson.UpVotes
self.downVotes = voteJson.DownVotes
self.userVote = voteJson.UserVote
self.canVote = voteJson.CanVote
self.cantVoteReason = voteJson.ReasonForNotVoteable
return self
end
return VoteData
@@ -0,0 +1,25 @@
return function()
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local VoteData = require(Modules.Shell.Models.VoteData)
it("should set fields without errors", function()
local testData =
{
UpVotes = 10000,
DownVotes = 1,
UserVote = false,
CanVote = true,
ReasonForNotVoteable = "Some reason."
}
local voteData = VoteData.fromJsonData(testData)
expect(voteData).to.be.a("table")
expect(voteData.upVotes).to.equal(10000)
expect(voteData.downVotes).to.equal(1)
expect(voteData.userVote).to.equal(false)
expect(voteData.canVote).to.equal(true)
expect(voteData.cantVoteReason).to.equal("Some reason.")
end)
end