alexjeffburke on camelCasedProxy
Split the camelCased chunk into… Prepare the camel cased interna… Throw together some code that g… (compare)
alexjeffburke on camelCaseProxy
Throw a basic camel case proxy … Exclude the "non-empty" variant… Split binding from the function… and 5 more (compare)
joelmukuthu on addAssertion
joelmukuthu on master
docs(addAssertion): document al… (compare)
joelmukuthu on addAssertion
docs(addAssertion): simplify al… (compare)
joelmukuthu on addAssertion
docs(addAssertion): fix typos docs(addAssertion): match headi… (compare)
joelmukuthu on addAssertion
docs(addAssertion): inline hand… (compare)
export = casepected;
declare const casepected: casepected.Expect;
declare namespace casepected {
/**
* The `expect` function is used every time you want to test a value.
* You will rarely call `expect` by itself.
*/
interface Expect {
/**
* The `expect` function is used every time you want to test a value.
* You will rarely call `expect` by itself.
*
* @param actual The value to apply matchers against.
*/
<T = any>(actual: T): Matchers;
it: Matchers;
}
interface Constructable {
new (...args: any[]): any;
}
type Result = Promise<any[]> | undefined;
interface Matchers {
notToBeOk(value: string): Result
notToBeTruthy(value: string): Result
toBeOk(value: string): Result
toBeTruthy(value: string): Result
notToBe(value: string|any): Result
toBe(value: string|any): Result
@alexjeffburke if we keep types out of the picture as it is basically impossible to type a meta programming system. (You can still make a your cased unexpected capable of writing out a type definition dynamically with all the plugins you chose to add, and any custom assertions to a file if you want).
Couldn't we just use a real https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy object instead of precalculating the methods?
toEqual()
definition in the source and the string assertion it translates to
@/all in summary: I believe the experiment has proven what it set out to - modulo some minor things we seem well placed to do this now if we wanted to. The bigger questions seem to be:
There’s likely some discussions and agreement we need on an approach as a group. Do folks agree on a GitHub issue as a next step?
expect(() => {
camelCased(['foo', 'it', 'do']).toHaveAnItemSatisfying(
camelCased.it.toHaveLength(3)
);
}, 'not to throw');
expect(queriedForFirst(foo, '.foo')).toSatisfy(<div>wat</div>)