Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove generator snippet interface #2241

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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