Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from Swatto/actions/runHomeScene
Add runHomeScene action and tweak facetime action
- Loading branch information
Showing
9 changed files
with
108 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { runHomeScene } from '../../src/actions'; | ||
import { askWhenRun } from '../../src/variables'; | ||
|
||
describe('runHomeScene function', () => { | ||
it('is a function', () => { | ||
expect(typeof runHomeScene).toBe('function'); | ||
}); | ||
|
||
it('builds a runHomeScene action with specified arguments', () => { | ||
const homeName = 'My test home'; | ||
const sceneName = 'My great test scene'; | ||
const expected = { | ||
WFWorkflowActionIdentifier: 'is.workflow.actions.runscene', | ||
WFWorkflowActionParameters: { | ||
WFHomeName: homeName, | ||
WFHomeSceneName: sceneName, | ||
}, | ||
}; | ||
const actual = runHomeScene({ homeName, sceneName }); | ||
|
||
expect(actual).toEqual(expected); | ||
}); | ||
|
||
it('builds a runHomeScene action with user choice on run', () => { | ||
const expected = { | ||
WFWorkflowActionIdentifier: 'is.workflow.actions.runscene', | ||
WFWorkflowActionParameters: { | ||
WFHomeName: { | ||
Value: { | ||
Type: 'Ask', | ||
}, | ||
WFSerializationType: 'WFTextTokenAttachment', | ||
}, | ||
WFHomeSceneName: { | ||
Value: { | ||
Type: 'Ask', | ||
}, | ||
WFSerializationType: 'WFTextTokenAttachment', | ||
}, | ||
}, | ||
}; | ||
const actual = runHomeScene({ homeName: askWhenRun, sceneName: askWhenRun }); | ||
|
||
expect(actual).toEqual(expected); | ||
}); | ||
}); |
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,42 @@ | ||
import WFSerialization from '../interfaces/WF/WFSerialization'; | ||
import WFWorkflowAction from '../interfaces/WF/WFWorkflowAction'; | ||
|
||
/** | ||
* @action Run Home Scene | ||
* @section Home > Home > | ||
* @icon Home | ||
* | ||
* Runs a specific or user selected Home scene | ||
* | ||
* ```js | ||
* // Run a specific scene at home | ||
* runHomeScene({ | ||
* homeName: 'My House', // You can find your name in the Home app | ||
* sceneName: 'Workday' | ||
* }); | ||
* // Let the user select the scene for a spefiic home | ||
* runHomeScene({ | ||
* homeName: 'My House', | ||
* sceneName: askWhenRun | ||
* }); | ||
* ``` | ||
*/ | ||
|
||
const runHomeScene = ( | ||
{ | ||
homeName, | ||
sceneName, | ||
}: { | ||
/** String of the home's name. */ | ||
homeName: WFSerialization | string, | ||
/** String of the scene's name. */ | ||
sceneName: WFSerialization | string, | ||
}): WFWorkflowAction => ({ | ||
WFWorkflowActionIdentifier: 'is.workflow.actions.runscene', | ||
WFWorkflowActionParameters: { | ||
WFHomeName: homeName, | ||
WFHomeSceneName: sceneName, | ||
}, | ||
}); | ||
|
||
export default runHomeScene; |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
type FaceTimeType = ( | ||
'Ask' | ||
| 'Audio' | ||
'Audio' | ||
| 'Video' | ||
); | ||
|
||
|
This file was deleted.
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
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