Skip to content

Commit

Permalink
test(registry): Added coverage for if error then use default value pa…
Browse files Browse the repository at this point in the history
…ssed from input
  • Loading branch information
meenahoda committed Jun 12, 2018
1 parent b7de0d7 commit b26649c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"Comment": "Test blueprint to get reg keys",
"version": "1.0",
"StartAt": "GetRegistryKey",
"States": {
"GetRegistryKey": {
"Type": "Task",
"Resource": "module:getConfiguredRegistryKey",
"ResourceConfig": {
"key": "tymlyTest_falseTestKey"
},
"ResultPath": "$.result",
"End": true
}
},
"restrictions": [
{
"roleId": "$authenticated",
"allows": [
"*"
]
}
]
}
10 changes: 10 additions & 0 deletions test/registry-state-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('registry key state resources', function () {
const newValue = 2
const setTestKey = 'tymlyTest_setTestKey_1_0'
const getTestKey = 'tymlyTest_getTestKey_1_0'
const getFalseTestKey = 'tymlyTest_getFalseTestKey_1_0'

it('check the value via the registry', () => {
expect(registry.get(regKeyName)).to.eql(expectedRegValue)
Expand Down Expand Up @@ -83,6 +84,15 @@ describe('registry key state resources', function () {
)
expect(execDesc.ctx.result).to.eql(newValue)
})

it('try to get registry value with a false key, expect default value', async () => {
const execDesc = await statebox.startExecution(
{ defaultValue: 123 },
getFalseTestKey,
{ sendResponse: 'COMPLETE' }
)
expect(execDesc.ctx.result.registryValue).to.eql(123)
})
})

describe('state resources using only event input', () => {
Expand Down

0 comments on commit b26649c

Please sign in to comment.