Skip to content

Commit

Permalink
Feat/update to bsc 0.49.0 (#167)
Browse files Browse the repository at this point in the history
* bump

* update to bsc 0.49.0

* fixes tests
  • Loading branch information
georgejecook authored May 9, 2022
1 parent 690826e commit 8125ae8
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 51 deletions.
8 changes: 8 additions & 0 deletions bsc-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [4.8.0](https://github.com/georgejecook/rooibos/compare/4.7.0...4.8.0)

- adds expectLastCallToThrowError so we can throw errors from fakes [`#166`](https://github.com/georgejecook/rooibos/pull/166)
- Quality of life fixes [`#162`](https://github.com/georgejecook/rooibos/pull/162)
- bump [`b04ee37`](https://github.com/georgejecook/rooibos/commit/b04ee37e6f3eb2a0d5929200b8ffb47755564eb0)

#### [4.7.0](https://github.com/georgejecook/rooibos/compare/4.6.1...4.7.0)

> 2 April 2022
- Feature/accept expect once with function param [`#157`](https://github.com/georgejecook/rooibos/pull/157)
- adds callfunc once method [`#156`](https://github.com/georgejecook/rooibos/pull/156)
- Update slack link [`#155`](https://github.com/georgejecook/rooibos/pull/155)
Expand Down
4 changes: 2 additions & 2 deletions bsc-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rooibos-roku",
"version": "4.7.0",
"version": "4.8.0",
"description": "simple, flexible, fun brightscript test framework for roku scenegraph apps - roku brighterscript plugin",
"repository": {
"type": "git",
Expand All @@ -26,7 +26,7 @@
"@types/node": "^17.0.29",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"brighterscript": "0.45.3",
"brighterscript": "0.49.0",
"chai": "^4.2.0",
"chai-subset": "^1.6.0",
"coveralls": "^3.0.0",
Expand Down
98 changes: 49 additions & 49 deletions bsc-plugin/src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,51 +348,51 @@ describe('RooibosPlugin', () => {
instance.super0_getTestSuiteData = instance.getTestSuiteData
instance.getTestSuiteData = function()
return {
name: "ATest",
isSolo: false,
noCatch: false,
isIgnored: false,
pkgPath: "${s`source/test.spec.bs`}",
filePath: "${s`${tmpPath}/rootDir/source/test.spec.bs`}",
lineNumber: 3,
valid: true,
hasFailures: false,
hasSoloTests: false,
hasIgnoredTests: false,
hasSoloGroups: false,
setupFunctionName: "",
tearDownFunctionName: "",
beforeEachFunctionName: "",
afterEachFunctionName: "",
isNodeTest: false,
nodeName: "",
generatedNodeName: "ATest",
name: "ATest"
isSolo: false
noCatch: false
isIgnored: false
pkgPath: "${s`source/test.spec.bs`}"
filePath: "${s`${tmpPath}/rootDir/source/test.spec.bs`}"
lineNumber: 3
valid: true
hasFailures: false
hasSoloTests: false
hasIgnoredTests: false
hasSoloGroups: false
setupFunctionName: ""
tearDownFunctionName: ""
beforeEachFunctionName: ""
afterEachFunctionName: ""
isNodeTest: false
nodeName: ""
generatedNodeName: "ATest"
testGroups: [
{
name: "groupA",
isSolo: false,
isIgnored: false,
filename: "${s`source/test.spec.bs`}",
lineNumber: "3",
setupFunctionName: "",
tearDownFunctionName: "",
beforeEachFunctionName: "",
afterEachFunctionName: "",
name: "groupA"
isSolo: false
isIgnored: false
filename: "${s`source/test.spec.bs`}"
lineNumber: "3"
setupFunctionName: ""
tearDownFunctionName: ""
beforeEachFunctionName: ""
afterEachFunctionName: ""
testCases: [
{
isSolo: false,
noCatch: false,
funcName: "groupA_is_test1",
isIgnored: false,
isParamTest: false,
name: "is test1",
lineNumber: 7,
paramLineNumber: 0,
assertIndex: 0,
assertLineNumberMap: {},
rawParams: invalid,
paramTestIndex: 0,
expectedNumberOfParams: 0,
isSolo: false
noCatch: false
funcName: "groupA_is_test1"
isIgnored: false
isParamTest: false
name: "is test1"
lineNumber: 7
paramLineNumber: 0
assertIndex: 0
assertLineNumberMap: {}
rawParams: invalid
paramTestIndex: 0
expectedNumberOfParams: 0
isParamsValid: true
}
]
Expand Down Expand Up @@ -480,17 +480,17 @@ describe('RooibosPlugin', () => {
m.currentAssertLineNumber = 8
m._expectCalled(m.thing, "callFunc", [
"getFunction",
"a",
"getFunction"
"a"
"b"
])
if m.currentResult.isFail then return invalid
m.currentAssertLineNumber = 9
m._expectCalled(m.thing, "callFunc", [
"getFunction",
"a",
"getFunction"
"a"
"b"
], "return")
if m.currentResult.isFail then return invalid
Expand Down Expand Up @@ -560,15 +560,15 @@ describe('RooibosPlugin', () => {
m.currentAssertLineNumber = 8
m._expectCalled(m.thing, "getFunction", [
"arg1",
"arg1"
"arg2"
])
if m.currentResult.isFail then return invalid
m.currentAssertLineNumber = 9
m._expectCalled(m.thing, "getFunction", [
"arg1",
"arg1"
"arg2"
], "return")
if m.currentResult.isFail then return invalid
Expand Down Expand Up @@ -613,15 +613,15 @@ describe('RooibosPlugin', () => {
m.currentAssertLineNumber = 9
m._expectCalled(item, "getFunction", [
"arg1",
"arg1"
"arg2"
])
if m.currentResult.isFail then return invalid
m.currentAssertLineNumber = 10
m._expectCalled(item, "getFunction", [
"arg1",
"arg1"
"arg2"
], "return")
if m.currentResult.isFail then return invalid
Expand Down
9 changes: 9 additions & 0 deletions framework/src/source/BaseTestSuite.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,15 @@ namespace rooibos
return fake
end function

function expectLastCallToThrowError(error as dynamic)
try
mock = m.mocks[m.__mockId.toStr()]
mock.toThrow(error)
catch error
m.log.error("could not add throw to last call", error)
end try
end function

function expectCalled(invocation as dynamic, returnValue = invalid as dynamic, thrownError = invalid as dynamic) as object
'mock function body - the plugin replaces this
return invalid
Expand Down
1 change: 1 addition & 0 deletions tests/src/source/NewExpectSyntax.spec.bs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

namespace tests
@only
@suite
class NewExpectSyntaxTests extends rooibos.BaseTestSuite

Expand Down

0 comments on commit 8125ae8

Please sign in to comment.