Skip to content

Commit

Permalink
More coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarber committed May 29, 2018
1 parent 6f35c0d commit 3423f1b
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 20 deletions.
16 changes: 16 additions & 0 deletions src/Models/Core/MainModule/BTKPlugin/init.spec.lua
@@ -0,0 +1,16 @@
return function()
local BTKPlugin = require(script.Parent)

describe("BTKPlugin", function()
it("should require ok", function()
expect(BTKPlugin).to.be.ok()
end)

--[[
--- @TODO no support for emulating plugins yet
it("should new ok", function()
expect(BTKPlugin:new()).to.be.ok()
end)
--]]
end)
end
16 changes: 16 additions & 0 deletions src/Models/Core/MainModule/UI/Components/AssetItem.spec.lua
@@ -0,0 +1,16 @@
return function()
local AssetItem = require(script.Parent.AssetItem)

describe("AssetItem", function()
it("should require ok", function()
expect(AssetItem).to.be.ok()
end)

--[[
--- @TODO cannot emulate marketplaceservice yet
it("should new ok", function()
expect(AssetItem:init()).to.be.ok()
end)
--]]
end)
end
1 change: 1 addition & 0 deletions src/Models/Core/MainModule/UI/Components/AssetsWidget.lua
Expand Up @@ -11,6 +11,7 @@ local c = Roact.createElement
local AssetsWidget = Roact.Component:extend("AssetsWidget")
function AssetsWidget:init(props)
assert(props)
self.state = {
Plugin = props.Plugin,
CurrentCategory = nil,
Expand Down
15 changes: 15 additions & 0 deletions src/Models/Core/MainModule/UI/Components/AssetsWidget.spec.lua
@@ -0,0 +1,15 @@
return function()
local AssetsWidget = require(script.Parent.AssetsWidget)

describe("AssetsWidget", function()
it("should require ok", function()
expect(AssetsWidget).to.be.ok()
end)

it("should new ok", function()
expect(AssetsWidget:init({
Plugin = "foo",
})).never.to.be.ok()
end)
end)
end
@@ -0,0 +1,15 @@
return function()
local ConfigurationWidget = require(script.Parent.ConfigurationWidget)

describe("ConfigurationWidget", function()
it("should require ok", function()
expect(ConfigurationWidget).to.be.ok()
end)

--[[ @TODO no support for selection
it("should new ok", function()
expect(ConfigurationWidget:init({})).never.to.be.ok()
end)
--]]
end)
end
13 changes: 13 additions & 0 deletions src/Models/Core/MainModule/UI/Components/Dropdown.spec.lua
@@ -0,0 +1,13 @@
return function()
local Dropdown = require(script.Parent.Dropdown)

describe("Dropdown", function()
it("should require ok", function()
expect(Dropdown).to.be.ok()
end)

it("should new ok", function()
expect(Dropdown:init({})).never.to.be.ok()
end)
end)
end
13 changes: 13 additions & 0 deletions src/Models/Core/MainModule/UI/Components/TextLabel.spec.lua
@@ -0,0 +1,13 @@
return function()
local TextLabel = require(script.Parent.TextLabel)

describe("TextLabel", function()
it("should require ok", function()
expect(TextLabel).to.be.ok()
end)

it("should new ok", function()
expect(TextLabel:init({})).never.to.be.ok()
end)
end)
end
13 changes: 13 additions & 0 deletions src/Models/Core/MainModule/UI/init.spec.lua
@@ -0,0 +1,13 @@
return function()
local UI = require(script.Parent)

describe("UI", function()
it("should require ok", function()
expect(UI).to.be.ok()
end)

it("should new ok", function()
expect(UI:new()).to.be.ok()
end)
end)
end
6 changes: 2 additions & 4 deletions src/Models/Core/MainModule/scripts/Area.lua
Expand Up @@ -7,14 +7,12 @@ local Area = Model:subclass(script.Name)
Area:AddProperty({
Name = "AreaPart",
Type = "ObjectValue",
ValueFn = function(self2)
return self2:GetPrimaryPart()
end,
SchemaFn = Schema:IsA("BasePart"),
SchemaFn = Schema.Optional(Schema:IsA("BasePart")),
})

function Area:initialize(input)
Model.initialize(self, input)
self:SetAreaPart(self:GetPrimaryPart())

local partValue = self:GetAreaPart()
partValue.Anchored = true
Expand Down
18 changes: 18 additions & 0 deletions src/Models/Core/MainModule/scripts/Area.spec.lua
@@ -0,0 +1,18 @@
return function()
local Area = require(script.Parent.Area)

describe("Area", function()
it("should require ok", function()
expect(Area).to.be.ok()
end)

--[[
--- @TODO this fails now
it("should new ok", function()
expect(Area:new({
Script = Instance.new("Script"),
})).to.be.ok()
end)
--]]
end)
end
12 changes: 4 additions & 8 deletions src/Models/Core/MainModule/scripts/Collectable.lua
Expand Up @@ -8,23 +8,19 @@ local Collectable = Model:subclass(script.Name)
Collectable:AddProperty({
Name = "CollectablePart",
Type = "ObjectValue",
ValueFn = function(self2)
return self2:GetPrimaryPart()
end,
SchemaFn = Schema:IsA("BasePart"),
SchemaFn = Schema.Optional(Schema:IsA("BasePart")),
})

Collectable:AddProperty({
Name = "CollectableAttachment",
Type = "ObjectValue",
ValueFn = function(self2)
return Instance.new("Attachment", self2:GetCollectablePart())
end,
SchemaFn = Schema:IsA("Attachment"),
SchemaFn = Schema.Optional(Schema:IsA("Attachment")),
})

function Collectable:initialize(input)
Model.initialize(self, input)
self:SetCollectableAttachment(self:GetPrimaryPart())
self:SetCollectableAttachment(Instance.new("Attachment", self:GetCollectablePart()))
end

return Collectable
8 changes: 3 additions & 5 deletions src/Models/Core/MainModule/scripts/PlatformMover.lua
Expand Up @@ -7,11 +7,6 @@ local PlatformMover = Model:subclass(script.Name)
PlatformMover:AddProperty({
Name = "PlatformPart",
Type = "ObjectValue",
ValueFn = function(self)
local a = self:GetPrimaryPart()
a.Anchored = true
return a
end,
SchemaFn = Schema:IsA("BasePart"),
})
PlatformMover:AddProperty({
Expand All @@ -37,6 +32,9 @@ PlatformMover:AddProperty({

function PlatformMover:initialize(input)
Model.initialize(self, input)
local a = self:GetPrimaryPart()
a.Anchored = true
self:SetPlatformPart(a)

self:GetStartPositionMarker().Transparency = 1
self:EndStartPositionMarker().Transparency = 1
Expand Down
4 changes: 1 addition & 3 deletions src/Models/Core/MainModule/scripts/Tool.lua
Expand Up @@ -10,9 +10,6 @@ local Tool = BaseScript:subclass(script.Name)
Tool:AddProperty({
Name = "Owner",
Type = "ObjectValue",
ValueFn = function(self)
self:_getOwner()
end,
SchemaFn = Schema.Optional(
Schema.CharacterModel
),
Expand All @@ -27,6 +24,7 @@ Tool:AddProperty({
function Tool:initialize(input)
BaseScript.initialize(self, input)
self:SetOwner(self:_getOwner())
self:AssertSchema(input.Root, Schema:IsA("Tool"))
Expand Down

0 comments on commit 3423f1b

Please sign in to comment.