Skip to content

Commit

Permalink
feat(tasks): Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
InvictusMB committed Feb 5, 2017
1 parent 7790774 commit f5e8e22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions spec/api/serenity/recording/step_annotation.spec.ts
@@ -1,6 +1,6 @@
import { Journal, StageManager } from '../../../../src/serenity/stage';

import { Actor, addDescription, PerformsTasks, step, Task } from '../../../../src/screenplay';
import { Actor, describeStep, PerformsTasks, step, Task } from '../../../../src/screenplay';

import expect = require('../../../expect');
import { ActivityFinished, ActivityStarts } from '../../../../src/serenity/domain/events';
Expand Down Expand Up @@ -147,7 +147,7 @@ describe('Notifiers', () => {

const PayWithCreditCard = {
number(creditCardNumber: string) {
return addDescription(
return describeStep(
actor => actor.attemptsTo( /*...*/ ),
`{0} pays with a credit card number ${creditCardNumber}`,
);
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('Notifiers', () => {

const PayWithInvalidCreditCardThrowingAnError = {
number(creditCardNumber: string) {
return addDescription(
return describeStep(
(actor: PerformsTasks) => { throw new Error('Payment failed'); },
`{0} pays with an invalid credit card number ${creditCardNumber}`,
);
Expand All @@ -198,7 +198,7 @@ describe('Notifiers', () => {

const PayWithInvalidCreditCardThrowingAnAssertionError = {
number(creditCardNumber: string) {
return addDescription(
return describeStep(
(actor: PerformsTasks) => expect(Promise.resolve(false)).to.eventually.equal(true),
`{0} pays with an invalid credit card number ${creditCardNumber}`,
);
Expand Down Expand Up @@ -232,7 +232,7 @@ describe('Notifiers', () => {

const PayWithInvalidCreditCardRejectingAPromise = {
number(creditCardNumber: string) {
return addDescription(
return describeStep(
(actor: PerformsTasks) => Promise.reject(new Error('Payment failed')),
`{0} pays with an invalid credit card number ${creditCardNumber}`,
);
Expand Down
4 changes: 2 additions & 2 deletions src/serenity/recording/step_annotation.ts
Expand Up @@ -3,14 +3,14 @@ import { Attemptable, Performable } from '../screenplay/performables';
// todo: add Significance to the @step
export function step<T extends Performable>(stepDescriptionTemplate: string): StepAnnotation<T> {
return (target: T, propertyKey: string, descriptor: PerformAsMethodSignature) => {
addDescription(target, stepDescriptionTemplate);
describeStep(target, stepDescriptionTemplate);
return descriptor;
};
}

export const StepAnnotationSymbol = Symbol('StepAnnotation');

export function addDescription<T extends Attemptable>(target: T, template: string): T {
export function describeStep<T extends Attemptable>(target: T, template: string): T {
target[StepAnnotationSymbol] = template;
return target;
}
Expand Down

0 comments on commit f5e8e22

Please sign in to comment.