-
Notifications
You must be signed in to change notification settings - Fork 98
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 issue/1-improve-documentation
- Loading branch information
Showing
45 changed files
with
480 additions
and
302 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
import { addToVariable } from '../../src/actions'; | ||
import { variable } from '../../src/utils'; | ||
|
||
describe('addToVariable function', () => { | ||
|
||
it('is a function', () => { | ||
expect(typeof addToVariable).toBe('function'); | ||
}); | ||
|
||
it('builds a addToVariable action when a name is passed', () => { | ||
const name = 'Test Variable'; | ||
it('builds a addToVariable action when a variable is passed', () => { | ||
const name = variable('Test Variable'); | ||
|
||
const expected = { | ||
WFWorkflowActionIdentifier: 'is.workflow.actions.appendvariable', | ||
WFWorkflowActionParameters: { | ||
WFVariableName: name, | ||
WFVariableName: name.VariableName, | ||
}, | ||
}; | ||
const actual = addToVariable({ name }); | ||
|
||
const actual = addToVariable({ | ||
variable: name, | ||
}); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,53 @@ | ||
import { getVariable } from '../../src/actions'; | ||
|
||
import WFSerialization from '../../src/interfaces/WF/WFSerialization'; | ||
import { | ||
actionOutput, | ||
variable, | ||
} from '../../src/utils'; | ||
|
||
describe('getVariable function', () => { | ||
|
||
it('is a function', () => { | ||
expect(typeof getVariable).toBe('function'); | ||
}); | ||
|
||
it('builds a getVariable action when a variable name is passed', () => { | ||
const name = 'variable'; | ||
it('builds a getVariable action when a variable is passed', () => { | ||
const namedVar = variable('variable'); | ||
|
||
const expected = { | ||
WFWorkflowActionIdentifier: 'is.workflow.actions.getvariable', | ||
WFWorkflowActionParameters: { | ||
WFVariable: { | ||
Value: { | ||
Type: 'Variable', | ||
VariableName: name, | ||
}, | ||
Value: namedVar, | ||
WFSerializationType: 'WFTextTokenAttachment', | ||
}, | ||
}, | ||
}; | ||
|
||
const actual = getVariable({ variable: name }); | ||
const actual = getVariable({ variable: namedVar }); | ||
|
||
expect(actual).toEqual(expected); | ||
}); | ||
|
||
it('builds a getVariable action when a variable UUID is passed', () => { | ||
const uuid = 'b74c81a8-192a-463f-a0a6-2d327963714f'; | ||
it('builds a getVariable action when a magic variable is passed', () => { | ||
const magic = actionOutput(); | ||
magic.OutputUUID = 'b74c81a8-192a-463f-a0a6-2d327963714f'; | ||
|
||
const expected = { | ||
WFWorkflowActionIdentifier: 'is.workflow.actions.getvariable', | ||
WFWorkflowActionParameters: { | ||
WFVariable: { | ||
Value: { | ||
OutputUUID: uuid, | ||
OutputUUID: magic.OutputUUID, | ||
Type: 'ActionOutput', | ||
}, | ||
WFSerializationType: 'WFTextTokenAttachment', | ||
}, | ||
}, | ||
}; | ||
|
||
const actual = getVariable({ variable: uuid }); | ||
const actual = getVariable({ variable: magic }); | ||
|
||
expect(actual).toEqual(expected); | ||
}); | ||
|
||
it('builds a getVariable action when a variable object is passed', () => { | ||
const uuid = 'b74c81a8-192a-463f-a0a6-2d327963714f'; | ||
|
||
const variableObject: WFSerialization = { | ||
Value: { | ||
OutputUUID: uuid, | ||
Type: 'ActionOutput', | ||
}, | ||
WFSerializationType: 'WFTextTokenAttachment', | ||
}; | ||
|
||
const expected = { | ||
WFWorkflowActionIdentifier: 'is.workflow.actions.getvariable', | ||
WFWorkflowActionParameters: { | ||
WFVariable: { | ||
Value: { | ||
OutputUUID: uuid, | ||
Type: 'ActionOutput', | ||
}, | ||
WFSerializationType: 'WFTextTokenAttachment', | ||
}, | ||
}, | ||
}; | ||
|
||
const actual = getVariable({ variable: variableObject }); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,5 @@ describe('runScriptOverSSH function', () => { | |
|
||
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,39 @@ | ||
import Attachment from '../../src/interfaces/WF/Attachment'; | ||
import { actionOutput } from '../../src/utils'; | ||
|
||
describe('actionOutput function', () => { | ||
|
||
it('is a function', () => { | ||
expect(typeof actionOutput).toBe('function'); | ||
}); | ||
|
||
it('returns an ActionOutput attachment object when passed nothing', () => { | ||
const uuid = '70a08121-f08d-46e4-a41f-102912750b11'; | ||
|
||
const actual = actionOutput(); | ||
actual.OutputUUID = uuid; | ||
|
||
const expected: Attachment = { | ||
OutputUUID: uuid, | ||
Type: 'ActionOutput', | ||
}; | ||
|
||
expect(actual).toEqual(expected); | ||
}); | ||
|
||
it('returns a custom named ActionOutput attachment object when passed a string', () => { | ||
const uuid = 'dd05b2e3-6069-4c4a-900a-79ae837795d6'; | ||
|
||
const actual = actionOutput('My Result'); | ||
actual.OutputUUID = uuid; | ||
|
||
const expected: Attachment = { | ||
OutputName: 'My Result', | ||
OutputUUID: uuid, | ||
Type: 'ActionOutput', | ||
}; | ||
|
||
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
Oops, something went wrong.