Skip to content

Commit

Permalink
docs(asynchronous-steps): update code formatting in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ychavoya committed May 14, 2024
1 parent 91dc81c commit 6a375ff
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/AsynchronousSteps.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defineFeature(feature, test => {
test('Adding a todo', ({ given, when, then }) => {
...

when('I save my changes', (done) => {
when('I save my changes', done => {
todo.saveChanges(() => {
console.log('Changes saved');
done(); // When the callback is called, the step will end
Expand Down Expand Up @@ -80,13 +80,14 @@ defineFeature(feature, test => {
test('Adding a todo', ({ given, when, then }) => {
...

when(/I save my changes with name (\w+)/, (name, done) => {
todo.saveChanges((error) => {
when('I save my changes', done => {
todo.saveChanges(error => {
if (error) {
done(error); // the test will fail if called with an argument
} else {
console.log(`Changes saved`);
done(); // the test will succeed if no argument is passed
}
console.log(`Changes saved with name ${name}`);
done(); // the test will succeed if no argument is passed
});
});

Expand Down

0 comments on commit 6a375ff

Please sign in to comment.