Skip to content

Commit

Permalink
remove generator snippet interface (#2241)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss authored Feb 16, 2023
1 parent 260e943 commit 90ebb80
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 29 deletions.
1 change: 0 additions & 1 deletion features/step_definition_snippets_interfaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Feature: step definition snippets custom syntax
Examples:
| INTERFACE | SNIPPET_FUNCTION_KEYWORD_AND_PARAMETERS | SNIPPET_IMPLEMENTATION |
| callback | function (callback) | callback(null, 'pending') |
| generator | function *() | return 'pending' |
| promise | function () | return Promise.resolve('pending') |
| async-await | async function () | return 'pending' |
| synchronous | function () | return 'pending' |
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export default class JavaScriptSnippetSyntax implements ISnippetSnytax {
let functionKeyword = 'function '
if (this.snippetInterface === SnippetInterface.AsyncAwait) {
functionKeyword = 'async ' + functionKeyword
} else if (this.snippetInterface === SnippetInterface.Generator) {
functionKeyword += '*'
}

let implementation: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,6 @@ describe('JavascriptSnippetSyntax', () => {
})
})

describe('generator interface', () => {
it('returns the proper snippet', function () {
// Arrange
const syntax = new JavascriptSnippetSyntax(SnippetInterface.Generator)
const buildOptions: ISnippetSyntaxBuildOptions = {
comment: 'comment',
functionName: 'functionName',
generatedExpressions: generateExpressions('"abc" def "ghi"'),
stepParameterNames: [],
}

// Act
const result = syntax.build(buildOptions)

// Assert
expect(result).to.eql(
reindent(`
functionName('{string} def {string}', function *(string, string2) {
// comment
return 'pending';
});`)
)
})
})

describe('promise interface', () => {
it('returns the proper snippet', function () {
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { GeneratedExpression } from '@cucumber/cucumber-expressions'
export enum SnippetInterface {
AsyncAwait = 'async-await',
Callback = 'callback',
Generator = 'generator',
Promise = 'promise',
Synchronous = 'synchronous',
}
Expand Down

0 comments on commit 90ebb80

Please sign in to comment.