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

feat: add Type to fast-check arbitrary adapter #1151

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

ShawnMorreau
Copy link
Collaborator

No description provided.

@ShawnMorreau ShawnMorreau marked this pull request as draft September 27, 2024 19:35
@ShawnMorreau ShawnMorreau marked this pull request as ready for review October 8, 2024 22:40
@ssalbdivad ssalbdivad changed the title feat: Fast check feat: add Type to fast-check arbitrary adapter Oct 9, 2024
@@ -162,7 +180,14 @@ describe("Arbitrary Generation", () => {
it("bounded array", () => {
const t = type("3<number[]<=5")
const arbitrary = arkToArbitrary(t)
assertProperty(arbitrary, t)
// assertProperty(arbitrary, t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix

return getArbitrary(fastCheckContext, nodeContext)
}

export type ArbitraryBuilderKeys = keyof ArbitraryBuilders

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type ArbitraryBuilder<t = unknown> = (fastCheckContext: FastCheckContext) => Arbitrary<t>

export const arbitraryBuilders: ArbitraryBuilders = {
number: fastCheckContext => generateNumberArbitrary(fastCheckContext),
bigint: fastCheckContext => bigInt(),
bigint: _fastCheckContext => bigInt(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

() => bigInt()

fastCheckAliasArbitrariesById: {},
currentNodeContext: node
})

export const arbitraryBuilders: ArbitraryBuilders = {
number: fastCheckContext => generateNumberArbitrary(fastCheckContext),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename these to ctx when we're using them

const getArbitrary = (
fastCheckContext: FastCheckContext,
nodeContext: NodeContext
) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiple branches annotate return type

"@ark/schema": "workspace:*",
"@ark/util": "workspace:*"
"@ark/util": "workspace:*",
"fast-check": "3.18.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use peer dependency + major version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants