Skip to content

Commit

Permalink
chainable: setup test file
Browse files Browse the repository at this point in the history
  • Loading branch information
gvergnaud committed May 8, 2023
1 parent 782750b commit 4b267c4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
29 changes: 26 additions & 3 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
### Roadmap

- [ ] Add a custom matcher protocol data structures could implement to make them matchable.
- [ ] Add a native regex support.
- [ ] chainable methods

- [ ] (Maybe) add an iterator protocol to `P.array` to be usable as a variadic tuple pattern. Example of using `P.array`:
- string
- `P.string.includes('str')`
- `P.string.startsWith('str')`
- `P.string.endsWith('str')`
- `P.string.regex('[a-z]+')`
- numbers
- `P.number.between(1, 10)`
- `P.number.lt(12)`
- `P.number.gt(12)`
- `P.number.gte(12)`
- `P.number.lte(12)`
- `P.number.int(12)`
- `P.number.finite`
- `P.number.positive`
- `P.number.negative`
- all
- `P.number.optional`
- `P.string.optional`
- `P.number.select()`
- `P.string.select()`
- `P.number.optional.select()`
- `P.string.optional.select()`

- [x] Add a custom matcher protocol data structures could implement to make them matchable.
- [x] (Maybe) add an iterator protocol to `P.array` to be usable as a variadic tuple pattern. Example of using `P.array`:

```ts
const reverse = <T>(xs: T[]): T[] => {
Expand Down
27 changes: 27 additions & 0 deletions tests/chainable.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
describe('chainable methods', () => {
describe('string', () => {
it(`P.string.includes('str')`, () => {});
it(`P.string.startsWith('str')`, () => {});
it(`P.string.endsWith('str')`, () => {});
it(`P.string.regex('[a-z]+')`, () => {});
});
describe('number', () => {
it(`P.number.between(1, 10)`, () => {});
it(`P.number.lt(12)`, () => {});
it(`P.number.gt(12)`, () => {});
it(`P.number.gte(12)`, () => {});
it(`P.number.lte(12)`, () => {});
it(`P.number.int(12)`, () => {});
it(`P.number.finite(12)`, () => {});
it(`P.number.positive(12)`, () => {});
it(`P.number.negative(12)`, () => {});
});
describe('all', () => {
it(`P.number.optional`, () => {});
it(`P.string.optional`, () => {});
it(`P.number.select()`, () => {});
it(`P.string.select()`, () => {});
it(`P.number.optional.select()`, () => {});
it(`P.string.optional.select()`, () => {});
});
});

0 comments on commit 4b267c4

Please sign in to comment.