-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bugfix/general-fixes
- Loading branch information
Showing
11 changed files
with
185 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"rootDir": "framework/src", | ||
"files": ["manifest", "source/**/*.*", "components/**/*.*"], | ||
"autoImportComponentScript": true, | ||
"createPackage": false, | ||
"stagingFolderPath": "dist", | ||
"diagnosticFilters": [ | ||
{ | ||
"src": "**/roku_modules/**/*.*", | ||
"codes": [1107, 1009] | ||
} | ||
], | ||
"plugins": ["@rokucommunity/bslint"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
namespace tests | ||
@suite | ||
class MockExample extends rooibos.BaseTestSuite | ||
|
||
protected override function setUp() | ||
super.setUp() | ||
end function | ||
|
||
protected override function beforeEach() | ||
m.SUT = SomeModel() | ||
end function | ||
|
||
protected override function afterEach() | ||
m.cleanMocks() | ||
m.cleanStubs() | ||
m.SUT = invalid | ||
end function | ||
|
||
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
@describe("Example Tests on SomeModel public methods") | ||
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
@it("globalMockExample1_passing") | ||
function _() | ||
m.stubCall(getManifestValue, function(key) : return "stubCall hardcoded title" : end function) | ||
m.SUT.globalMockExample() | ||
m.assertEqual(m.SUT.appTitle, "stubCall hardcoded title") | ||
end function | ||
|
||
@it("globalMockExample2_crashing_due_to_returnValue") | ||
@params("stubCall dynamic title") | ||
function _(manifestValue as string) | ||
m.stubCall(getManifestValue, manifestValue) | ||
m.SUT.globalMockExample() | ||
m.assertEqual(m.SUT.appTitle, manifestValue) | ||
end function | ||
|
||
@it("stubExample1_passing") | ||
@params({ configSetVia_config: true }, { configSetViaStub: true }) | ||
function _(config1 as object, config2 as object) | ||
m.SUT._config = config1 | ||
m.stub(m.SUT, "_getConfig", config2) | ||
m.SUT.setUpdatedConfig1() | ||
expectedKeyNameConfig2 = config2.keys()[0] | ||
resultKeyName = m.SUT.updatedConfig.keys()[0] | ||
m.assertEqual(expectedKeyNameConfig2, resultKeyName) | ||
end function | ||
|
||
@ignore("this is not supported - we do not support mocking singleton objects between test runs") | ||
@it("stubExample2_crashing_stub_from_stubExample1_persisting") | ||
@params({ configSetVia_config: true }, { configSetViaStub: true }) | ||
function _(config1 as object, config2 as object) | ||
m.SUT._config = config1 | ||
m.SUT.setUpdatedConfig2() | ||
expectedKeyNameConfig1 = config1.keys()[0] | ||
resultKeyName = m.SUT.updatedConfig.keys()[0] | ||
m.assertEqual(expectedKeyNameConfig1, resultKeyName) | ||
end function | ||
|
||
end class | ||
end namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function SomeModel() as object | ||
if (m._someModel = invalid) | ||
|
||
obj = {} | ||
obj.appTitle = "" | ||
obj._config = invalid | ||
obj.updatedConfig = invalid | ||
|
||
obj.globalMockExample = sub() | ||
appTitle = getManifestValue("title") | ||
m.appTitle = appTitle | ||
end sub | ||
|
||
obj.setUpdatedConfig1 = sub() | ||
m.updatedConfig = m._getConfig() | ||
end sub | ||
|
||
obj.setUpdatedConfig2 = sub() | ||
m.updatedConfig = m._getConfig() | ||
end sub | ||
|
||
obj._getConfig = function() as object | ||
return m._config | ||
end function | ||
|
||
m._someModel = obj | ||
end if | ||
|
||
return m._someModel | ||
end function | ||
|
||
function getManifestValue(key as string) as string | ||
return createObject("roAppInfo").getValue(key) | ||
end function |