Skip to content

Commit

Permalink
Add test that shows how fluent methods can be declared
Browse files Browse the repository at this point in the history
  • Loading branch information
aedart committed Feb 27, 2024
1 parent 398ae54 commit 41a0b1c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/browser/packages/support/concerns/use-edge-cases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,37 @@ describe('@aedart/support/concerns', () => {
expect(callback)
.toThrowError(AliasConflictError);
});

it('can make "fluent" methods', () => {

class ConcernA extends AbstractConcern {
with(value) {
// ...value ignored here...

return this.concernOwner;
}
}

/**
* @property {(value: string) => this} with Add a value to the request...
*/
@use(ConcernA)
class Service {
request() {
return 'done';
}
}

const instance = new Service();

const result = instance
.with('a')
.with('b')
.with('c')
.request();

expect(result)
.toBe('done');
});
});
});

0 comments on commit 41a0b1c

Please sign in to comment.