Skip to content

Commit

Permalink
Merge pull request #50 from TAServers/LEST-NONE-improve-docs-exports
Browse files Browse the repository at this point in the history
LEST-NONE - Improve docs exports
  • Loading branch information
Derpius authored Jul 1, 2023
2 parents b1fc8fe + 9e73ee8 commit c5d6808
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 47 deletions.
10 changes: 10 additions & 0 deletions packages/docs/functions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export { default as afterAll } from "./afterAll.json";
export { default as afterEach } from "./afterEach.json";
export { default as beforeAll } from "./beforeAll.json";
export { default as beforeEach } from "./beforeEach.json";
export { default as describe } from "./describe.json";
export { default as describeEach } from "./describe-each.json";
export { default as expect } from "./expect.json";
export { default as lestFn } from "./fn.json";
export { default as test } from "./test.json";
export { default as testEach } from "./test-each.json";
3 changes: 3 additions & 0 deletions packages/docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./functions";
export * from "./matchers";
export * from "./types";
1 change: 1 addition & 0 deletions packages/docs/matchers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./symmetric";
30 changes: 30 additions & 0 deletions packages/docs/matchers/symmetric/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export { default as toBe } from "./toBe.json";
export { default as toBeCloseTo } from "./toBeCloseTo.json";
export { default as toBeDefined } from "./toBeDefined.json";
export { default as toBeFalsy } from "./toBeFalsy.json";
export { default as toBeGreaterThan } from "./toBeGreaterThan.json";
export { default as toBeGreaterThanOrEqual } from "./toBeGreaterThanOrEqual.json";
export { default as toBeInfinity } from "./toBeInfinity.json";
export { default as toBeInstanceOf } from "./toBeInstanceOf.json";
export { default as toBeLessThan } from "./toBeLessThan.json";
export { default as toBeLessThanOrEqual } from "./toBeLessThanOrEqual.json";
export { default as toBeNaN } from "./toBeNaN.json";
export { default as toBeTruthy } from "./toBeTruthy.json";
export { default as toBeUndefined } from "./toBeUndefined.json";
export { default as toContain } from "./toContain.json";
export { default as toContainEqual } from "./toContainEqual.json";
export { default as toEqual } from "./toEqual.json";
export { default as toHaveBeenCalled } from "./toHaveBeenCalled.json";
export { default as toHaveBeenCalledTimes } from "./toHaveBeenCalledTimes.json";
export { default as toHaveBeenCalledWith } from "./toHaveBeenCalledWith.json";
export { default as toHaveBeenLastCalledWith } from "./toHaveBeenLastCalledWith.json";
export { default as toHaveBeenNthCalledWith } from "./toHaveBeenNthCalledWith.json";
export { default as toHaveReturned } from "./toHaveReturned.json";
export { default as toHaveReturnedTimes } from "./toHaveReturnedTimes.json";
export { default as toHaveReturnedWith } from "./toHaveReturnedWith.json";
export { default as toHaveLastReturnedWith } from "./toHaveLastReturnedWith.json";
export { default as toHaveNthReturnedWith } from "./toHaveNthReturnedWith.json";
export { default as toHaveLength } from "./toHaveLength.json";
export { default as toMatch } from "./toMatch.json";
export { default as toMatchObject } from "./toMatchObject.json";
export { default as toThrow } from "./toThrow.json";
2 changes: 2 additions & 0 deletions packages/docs/types/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as mock } from "./mock.json";
export { default as mockResult } from "./mock-result.json";
69 changes: 33 additions & 36 deletions packages/site/docs/api/expect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,39 @@ title: Expect
import FunctionRenderer from "@site/src/components/FunctionRenderer";
import MatcherRenderer from "@site/src/components/MatcherRenderer";

import expect from "@lest/docs/functions/expect.json";

import toBe from "@lest/docs/matchers/symmetric/toBe.json";
import toBeDefined from "@lest/docs/matchers/symmetric/toBeDefined.json";
import toBeUndefined from "@lest/docs/matchers/symmetric/toBeUndefined.json";
import toBeFalsy from "@lest/docs/matchers/symmetric/toBeFalsy.json";
import toBeTruthy from "@lest/docs/matchers/symmetric/toBeTruthy.json";
import toBeInstanceOf from "@lest/docs/matchers/symmetric/toBeInstanceOf.json";
import toEqual from "@lest/docs/matchers/symmetric/toEqual.json";

import toHaveBeenCalled from "@lest/docs/matchers/symmetric/toHaveBeenCalled.json";
import toHaveBeenCalledTimes from "@lest/docs/matchers/symmetric/toHaveBeenCalledTimes.json";
import toHaveBeenCalledWith from "@lest/docs/matchers/symmetric/toHaveBeenCalledWith.json";
import toHaveBeenLastCalledWith from "@lest/docs/matchers/symmetric/toHaveBeenLastCalledWith.json";
import toHaveBeenNthCalledWith from "@lest/docs/matchers/symmetric/toHaveBeenNthCalledWith.json";
import toHaveReturned from "@lest/docs/matchers/symmetric/toHaveReturned.json";
import toHaveReturnedTimes from "@lest/docs/matchers/symmetric/toHaveReturnedTimes.json";
import toHaveReturnedWith from "@lest/docs/matchers/symmetric/toHaveReturnedWith.json";
import toHaveLastReturnedWith from "@lest/docs/matchers/symmetric/toHaveLastReturnedWith.json";
import toHaveNthReturnedWith from "@lest/docs/matchers/symmetric/toHaveNthReturnedWith.json";

import toBeCloseTo from "@lest/docs/matchers/symmetric/toBeCloseTo.json";
import toBeGreaterThan from "@lest/docs/matchers/symmetric/toBeGreaterThan.json";
import toBeGreaterThanOrEqual from "@lest/docs/matchers/symmetric/toBeGreaterThanOrEqual.json";
import toBeLessThan from "@lest/docs/matchers/symmetric/toBeLessThan.json";
import toBeLessThanOrEqual from "@lest/docs/matchers/symmetric/toBeLessThanOrEqual.json";
import toBeNaN from "@lest/docs/matchers/symmetric/toBeNaN.json";
import toBeInfinity from "@lest/docs/matchers/symmetric/toBeInfinity.json";

import toHaveLength from "@lest/docs/matchers/symmetric/toHaveLength.json";
import toContain from "@lest/docs/matchers/symmetric/toContain.json";
import toContainEqual from "@lest/docs/matchers/symmetric/toContainEqual.json";
import toMatchObject from "@lest/docs/matchers/symmetric/toMatchObject.json";

import toMatch from "@lest/docs/matchers/symmetric/toMatch.json";
import toThrow from "@lest/docs/matchers/symmetric/toThrow.json";
import {
expect,
toBe,
toBeDefined,
toBeUndefined,
toBeFalsy,
toBeTruthy,
toBeInstanceOf,
toEqual,
toHaveBeenCalled,
toHaveBeenCalledTimes,
toHaveBeenCalledWith,
toHaveBeenLastCalledWith,
toHaveBeenNthCalledWith,
toHaveReturned,
toHaveReturnedTimes,
toHaveReturnedWith,
toHaveLastReturnedWith,
toHaveNthReturnedWith,
toBeCloseTo,
toBeGreaterThan,
toBeGreaterThanOrEqual,
toBeLessThan,
toBeLessThanOrEqual,
toBeNaN,
toBeInfinity,
toHaveLength,
toContain,
toContainEqual,
toMatchObject,
toMatch,
toThrow,
} from "@lest/docs";

<FunctionRenderer {...expect} headingLevel="h2">

Expand Down
9 changes: 1 addition & 8 deletions packages/site/docs/api/globals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ title: Globals

import FunctionRenderer from "@site/src/components/FunctionRenderer";

import afterAll from "@lest/docs/functions/afterAll.json";
import afterEach from "@lest/docs/functions/afterEach.json";
import beforeAll from "@lest/docs/functions/beforeAll.json";
import beforeEach from "@lest/docs/functions/beforeEach.json";
import describe from "@lest/docs/functions/describe.json";
import describeEach from "@lest/docs/functions/describe-each.json";
import test from "@lest/docs/functions/test.json";
import testEach from "@lest/docs/functions/test-each.json";
import { afterAll, afterEach, beforeAll, beforeEach, describe, describeEach, test, testEach } from "@lest/docs";

In your test files, Lest puts each of these methods and objects into the global environment. You don't have to require or import anything to use them.

Expand Down
2 changes: 1 addition & 1 deletion packages/site/docs/api/lest-object.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: The Lest Object

import FunctionRenderer from "@site/src/components/FunctionRenderer";

import lestFn from "@lest/docs/functions/fn.json";
import { lestFn } from "@lest/docs";

## Mock Functions

Expand Down
3 changes: 1 addition & 2 deletions packages/site/docs/api/mock-functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ title: Mock Functions

import { ObjectRenderer, FieldRenderer } from "@site/src/components/object-renderer";

import mock from "@lest/docs/types/mock.json";
import mockResult from "@lest/docs/types/mock-result.json";
import { mock, mockResult } from "@lest/docs";

Mock functions allow stubbing and/or inspecting functions when testing.
This is especially used when unit testing, where you'll likely need to mock unrelated units of your code or code from other packages or libraries.allow
Expand Down

0 comments on commit c5d6808

Please sign in to comment.