Skip to content

Instantly share code, notes, and snippets.

View esmevane's full-sized avatar

Joseph McCormick esmevane

View GitHub Profile
@esmevane
esmevane / App.test.tsx
Created June 2, 2020 19:59
[ Typescript / React ]: Login kata 06-02-2020
import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import App, { AppContext } from './App';
const SpiesOnApp = () => {
const context = React.useContext(AppContext);
return <>{JSON.stringify(context)}</>;
};
test('tracks username', async () => {
Explorer
Uninitialized
Rehydrate -> Ready
Ready&
Requesting -> Ready
Results
Idle
Requesting -> Loading
Loading
Success -> Idle
@esmevane
esmevane / machine.js
Created April 7, 2020 13:52
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@esmevane
esmevane / machine.js
Last active April 21, 2020 14:46
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
App
Unauthenticated*
Check Credentials -> Authenticating
Authenticating
Authentication Success -> Authorized
Authentication Failure -> Unauthorized
Unauthorized
Authorized
Unauthorized -> Unauthorized
Dashboard&*
@esmevane
esmevane / hierarchy.ts
Created December 16, 2018 15:02
[ Themes / Typescript ]: Hierarchical theme type & helper functions
// tslint:disable:object-literal-sort-keys
interface MinorHierarchy<T> {
one: T
two: T
three: T
four: T
}
export const createMinorHierarchy = <T>(
@esmevane
esmevane / SketchSystems.spec
Last active November 9, 2018 17:39
Enrollment wizard
Enrollment wizard
Visitor?*
Get prospect id? -> Prospect id request?
Has prospect id? -> Prospect details request?
Error
Return to enrollment -> Visitor?
Prospect id request?
Success? -> Prospect enrollment
@esmevane
esmevane / SketchSystems.spec
Created November 8, 2018 19:42
Enrollment wizard
Enrollment wizard
Visitor?*
Get prospect id? -> Prospect id request?
Error
Return to enrollment -> Visitor?
Prospect id request?
Success? -> Prospect enrollment
Failure? -> Error
@esmevane
esmevane / index.tsx
Created November 7, 2018 04:24
[ Typescript / React / ProseMirror ]: Put React components into ProseMirror NodeViews
// This assumes Styled Components is in play, as well.
//
// Here we have the (too simple) React component which
// we'll be rendering content into.
//
class Underlined extends React.Component<any, any> {
public hole: HTMLElement | null
// We'll put the content into what we render using
Login
Incomplete form*
Empty*
Add username -> Username filled out
Add password -> Password filled out
Submit -> Empty
Username filled out
Add password -> All fields filled out
Submit -> Username required prompt
Password filled out