Skip to content

Instantly share code, notes, and snippets.

import { chop1, chop2, chop3, chop4, chop5 } from "app/features/code-kata/kata02/index";
describe("kata02", () => {
function assert_equal(result: number, expected: number) {
expect(expected).toBe(result);
}
function its(logic: (a: number, b: number[]) => number) {
it("1", () => assert_equal(-1, logic(3, [])));
it("2", () => assert_equal(-1, logic(3, [1])));
it("3", () => assert_equal(0, logic(1, [1])));
@HiroshiOHSUGA
HiroshiOHSUGA / SampleStories05.tsx
Created January 14, 2022 09:49
022 Jan Eureka Blog 05 SampleStories.tsx
import { Meta, Story } from "@storybook/react";
import { Page } from ".";
import { Route } from "react-router";
import { RouterDecorator } from "../../router/RouterDecorator";
import { useUrl } from "../../router/useUrl";
const meta: Meta = {
title: "Samples/SpecificRoute",
component: Page,
decorators: [RouterDecorator()]
};
@HiroshiOHSUGA
HiroshiOHSUGA / SampleStories.tsx
Created January 14, 2022 09:03
2022 Jan Eureka Blog 03 SampleStories.tsx
import { Meta, Story } from "@storybook/react";
import React from "react";
import { Page } from ".";
import { text } from "../../emulations/text";
const meta: Meta = {
title: "Samples/InputEmulations",
component: Page,
decorators: []
};
@HiroshiOHSUGA
HiroshiOHSUGA / SampleStories.tsx
Created January 14, 2022 08:41
2022 Jan Eureka Blog 02 SampleStories.tsx
import { Meta, Story } from "@storybook/react";
import { Page } from ".";
import { getUserHandler } from "../../msw-handlers/user-handler";
const getHandlers = (options: Partial<{ loading: boolean }> = {}) => {
const { loading = false } = options;
return [
getUserHandler({
id: "user-1",
loading
@HiroshiOHSUGA
HiroshiOHSUGA / SampleStories.tsx
Last active January 14, 2022 08:41
2022 Jan Eureka Blog 01 SampleStories.tsx
import { Meta, Story } from "@storybook/react";
import { useState } from "../../redux-decorator/redux-debug";
import { ReduxDecorator } from "../../redux-decorator/ReduxDecorator";
import { Page } from ".";
const meta: Meta = {
title: "Samples/ReduxDecorator",
component: Page,
decorators: [ReduxDecorator()]
};
@HiroshiOHSUGA
HiroshiOHSUGA / ReducerRegistry.test.ts
Last active November 24, 2018 08:35
ReducerRegistry.ts
import { privateNoopReducer, ReducerRegistry } from "../ReducerRegistry";
describe("app/store/ReducerRegistry", () => {
describe("prepare (設定済みのregistoryに準備を要求する)", () => {
it("要求したloaderが呼び出されてmapで設定した位置にreducerが設定される", async () => {
const mockReducer = jest.fn();
const map = {
p1: async () => {
return Promise.resolve(mockReducer);
},
@HiroshiOHSUGA
HiroshiOHSUGA / _まとめ.md
Last active October 17, 2018 02:17
Promise確認
@HiroshiOHSUGA
HiroshiOHSUGA / find-result.txt
Created October 16, 2018 02:17
docz build 成果物
dist
dist/index.html
dist/static
dist/static/js
dist/static/js/app.c0a071d6.js
dist/static/js/runtime~app.80093f6b938c45dfa1fa.js
dist/static/js/vendors.389df6a6.js
dist/assets.json
@HiroshiOHSUGA
HiroshiOHSUGA / dump-loader.js
Created August 29, 2018 02:20
loaderの動作結果を出力するloader
const loaderUtils = require("loader-utils");
module.exports = function(source, map, meta ) {
const options = loaderUtils.getOptions(this) || {prefix: '', returnInPitch: false};
const {prefix, returnInPitch } = options;
print(options);
print(options);
print(options);
print(options);
print(options, `--------------------- ${prefix} normal --------------------------`);