diff --git a/packages/docs/.vuepress/config.js b/packages/docs/.vuepress/config.js index ed4c8bf..07b709d 100644 --- a/packages/docs/.vuepress/config.js +++ b/packages/docs/.vuepress/config.js @@ -15,6 +15,10 @@ module.exports = { "/zh-Hant/": { message: "新內容可用。", buttonText: "刷新" + }, + "/yor/": { + message: "", + buttonText: "" } } }, @@ -90,6 +94,39 @@ module.exports = { children: [] } ] + }, + "/yor/": { + selectText: "", + label: "", + editLinkText: "", + sidebar: [ + "/yor/", + { + title: "@onyx/matchers", + path: "/yor/matchers/", + children: [ + "/yor/matchers/matchers/to-be", + "/yor/matchers/matchers/to-be-defined", + "/yor/matchers/matchers/to-be-false", + "/yor/matchers/matchers/to-be-instance-of", + "/yor/matchers/matchers/to-be-nan", + "/yor/matchers/matchers/to-be-null", + "/yor/matchers/matchers/to-be-true", + "/yor/matchers/matchers/to-be-type-of", + "/yor/matchers/matchers/to-be-undefined", + "/yor/matchers/matchers/to-contain", + "/yor/matchers/matchers/to-equal", + "/yor/matchers/matchers/to-have-length", + "/yor/matchers/matchers/to-strictly-equal", + "/yor/matchers/matchers/to-throw" + ] + }, + { + title: "@onyx/mock", + path: "/yor/mock/", + children: [] + } + ] } } }, @@ -108,6 +145,11 @@ module.exports = { lang: "zh-TW", title: "Onyx", description: "Onyx是一個JavaScript測試框架。" + }, + "/yor/": { + lang: "yor-NIG", + title: "Onyx", + description: "" } } }; diff --git a/packages/docs/yor/README.md b/packages/docs/yor/README.md new file mode 100644 index 0000000..16aba4d --- /dev/null +++ b/packages/docs/yor/README.md @@ -0,0 +1,9 @@ +# Onyx +![Onyx logo](/onyx/onyx-logo-sm.svg) + +[![kiko ipo](https://travis-ci.org/onyxjs/onyx.svg?branch=master)](https://travis-ci.org/onyxjs/onyx) +[![codecov](https://codecov.io/gh/onyxjs/onyx/branch/master/graph/badge.svg)](https://codecov.io/gh/onyxjs/onyx) + +> Onyx je ibi awoose fun JavaScript + +Translated by Ibrahim Olanrewaju Abdulkareem, iabdulkareem94@gmail.com diff --git a/packages/docs/yor/matchers/README.md b/packages/docs/yor/matchers/README.md new file mode 100644 index 0000000..7b91a93 --- /dev/null +++ b/packages/docs/yor/matchers/README.md @@ -0,0 +1,4 @@ +# @onyx/matchers +![Onyx logo](/onyx/onyx-logo-sm.svg) + +apo yi le shey matcher ti yo shey afiwe otun le shey afowosi otun le so iyato ni arin orisirisi tests wa. \ No newline at end of file diff --git a/packages/docs/yor/matchers/expect/expect.md b/packages/docs/yor/matchers/expect/expect.md new file mode 100644 index 0000000..8c6c4eb --- /dev/null +++ b/packages/docs/yor/matchers/expect/expect.md @@ -0,0 +1,16 @@ +## expect + +> ibuwolu: `expect ( matchers: { [ key: string ]: Function }, expectation: any): any` + +`expect` ofi aye sile lati fi shey igbeyewo iwulo lori awon iye ko kan ki o ba le pade awon ireti to daaju . ise `expect` le so owo po pelu `matcher` lati shey afowosi iye ireti to daju ti o si wu wa. + +### Apeere + +```ts +import { expect } from '@onyx/matchers'; + +console.log(expect(1).toBeTypeOf('number')); // true +console.log(expect('string').toHaveLength(6)); // true +console.log(expect(2).not.toBeTypeOf('number')); // false +console.log(expect('string').not.toHaveLength(6)); // false +``` diff --git a/packages/docs/yor/matchers/matchers/README.md b/packages/docs/yor/matchers/matchers/README.md new file mode 100644 index 0000000..7bff8a4 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/README.md @@ -0,0 +1,18 @@ +## Matcher functions +Gbogbo ise matcher ni owa ni ibibi: +- [toBe](to-be) +- [toBeDefined](to-be-defined) +- [toBeFalse](to-be-false) +- [toBeFalsy](to-be-falsy) +- [toBeInstanceOf](to-be-instance-of) +- [toBeNaN](to-be-nan) +- [toBeNull](to-be-null) +- [toBeTrue](to-be-true) +- [toBeTruthy](to-be-truthy) +- [toBeTypeOf](to-be-type-of) +- [toBeUndefined](to-be-undefined) +- [toContain](to-contain) +- [toEqual](to-equal) +- [toHaveLength](to-have-length) +- [toStrictlyEqual](to-strictly-equal) +- [toThrow](to-throw) diff --git a/packages/docs/yor/matchers/matchers/to-be-defined.md b/packages/docs/yor/matchers/matchers/to-be-defined.md new file mode 100644 index 0000000..f9e91f3 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-defined.md @@ -0,0 +1,17 @@ +## toBeDefined + +> Ibuwolu: `toBeDefined (a: any): boolean` + +`toBeDefined` shey ayewo iye ti o ti wa tele. yo da rara nikan pada `false` ti ko ba ti si iye na tele `undefined` fun igbewole wa + +### Apeere + +```ts +import { toBeDefined } from '@onyx/matchers'; + +console.log(toBeDefined(1)); // true +console.log(toBeDefined({}); // true +console.log(toBeDefined(NaN)); // true +console.log(toBeDefined(null)); // true +console.log(toBeDefined(undefined)); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-be-false.md b/packages/docs/yor/matchers/matchers/to-be-false.md new file mode 100644 index 0000000..a0e3fc9 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-false.md @@ -0,0 +1,18 @@ +## toBeFalse (toBeFalsy) + +> Ibuwolu: `toBeFalse (a: any): boolean` + +`toBeFalse` matcher (ole tun je `toBeFalsy`) se ayewo boya iye ti a fun o kin shey iro. + +### Apeere + +```ts +import { toBeFalse } from '@onyx/matchers'; + +console.log(toBeFalse(false)); // true +console.log(toBeFalse(undefined)); // true +console.log(toBeFalse(NaN)); // true +console.log(toBeFalse(0)); // true +console.log(toBeFalse(1)); // false +console.log(toBeFalse({})); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-be-instance-of.md b/packages/docs/yor/matchers/matchers/to-be-instance-of.md new file mode 100644 index 0000000..b8d536a --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-instance-of.md @@ -0,0 +1,16 @@ +## toBeInstanceOf + +> Ibuwolu: `toBeInstanceOf (a: any, b: Function): boolean` + +`toBeInstanceOf` matcher shey ayewo boya iru igbewole arguementi akoko ni iru igbewole arguementi elekeji. + +### Apeere + +```ts +import { toBeInstanceOf } from '@onyx/matchers'; + +console.log(toBeInstanceOf(document, Document)); // true +console.log(toBeInstanceOf(document.body, Element)); // true +console.log(toBeInstanceOf([], Array)); // true +console.log(toBeInstanceOf({}, Element)); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-be-nan.md b/packages/docs/yor/matchers/matchers/to-be-nan.md new file mode 100644 index 0000000..39ae464 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-nan.md @@ -0,0 +1,16 @@ +## toBeNaN + +> Ibuwolu: `toBeNaN (a: any, b: any): boolean` + +`toBeNaN` matcher ma Shey ayewo boya iye ti a fun je `NaN`. Ti iye na ba je string to, `toBeNaN` ma parse e. + +### Apeere + +```ts +import { toBeNaN } from '@onyx/matchers'; + +console.log(toBeNaN(NaN)); // true +console.log(toBeNaN('onyx')); // true +console.log(toBeNaN(1)); // false +console.log(toBeNaN(1337)); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-be-null.md b/packages/docs/yor/matchers/matchers/to-be-null.md new file mode 100644 index 0000000..84fcf33 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-null.md @@ -0,0 +1,14 @@ +## toBeNull + +> Ibuwolu: `toBeNull (a: any): boolean` + +`toBeNull` matcher shey ayewo iye ti a fun boya o je `null`. + +### Apeere + +```ts +import { toBeNull } from '@onyx/matchers'; + +console.log(toBeNull(null)); // true +console.log(toBeNull(1)); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-be-true.md b/packages/docs/yor/matchers/matchers/to-be-true.md new file mode 100644 index 0000000..f81d7db --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-true.md @@ -0,0 +1,18 @@ +## toBeTrue (toBeTruthy) + +> Ibuwolu: `toBeTrue (a: any): boolean` + +`toBeTrue` matcher (abi ki a pe ni `toBeTruthy`) shey ayewo boya iye ti a fun je ooto + +### Apeere + +```ts +import { toBeTrue } from '@onyx/matchers'; + +console.log(toBeTrue(false)); // false +console.log(toBeTrue(undefined)); // false +console.log(toBeTrue(NaN)); // false +console.log(toBeTrue(0)); // false +console.log(toBeTrue(1)); // true +console.log(toBeTrue({})); // true +``` diff --git a/packages/docs/yor/matchers/matchers/to-be-type-of.md b/packages/docs/yor/matchers/matchers/to-be-type-of.md new file mode 100644 index 0000000..b5fa832 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-type-of.md @@ -0,0 +1,16 @@ +## toBeTypeOf + +> Ibuwolu: `toBeTypeOf (a: any, b: Function): boolean` + +`toBeTypeOf` matcher shey ayewo fun iru igbewole arguementi akoko. + +### Apeere + +```ts +import { toBeTypeOf } from '@onyx/matchers'; + +console.log(toBeTypeOf('', 'string')); // true +console.log(toBeTypeOf(22, 'number')); // true +console.log(toBeTypeOf([], 'array')); // true +console.log(toBeTypeOf({}, 'boolean')); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-be-undefined.md b/packages/docs/yor/matchers/matchers/to-be-undefined.md new file mode 100644 index 0000000..246ed16 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be-undefined.md @@ -0,0 +1,16 @@ +## toBeUndefined + +> Ibuwolu: `toBeUndefined (a: any): boolean` + +`toBeUndefined` matcher shey ayewo fun arguementi igbewole boya ko si tele. + +### Apeere + +```ts +import { toBeUndefined } from '@onyx/matchers'; + +console.log(toBeUndefined('')); // false +console.log(toBeUndefined(undefined)); // true +console.log(toBeUndefined(null)); // false +console.log(toBeUndefined({})); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-be.md b/packages/docs/yor/matchers/matchers/to-be.md new file mode 100644 index 0000000..1fa933d --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-be.md @@ -0,0 +1,18 @@ +## toBe + +> Ibuwolu: `toBe (a: any, b: any): boolean` + +`toBe` matcher shey afilo `lodash.isEqual` ati `Object.is` labe nkan afibo lati fi shey afiwe awon iye. ode ma da ooto pada `true` ti awon iye yen ba jo arawon, `false` o si ma da rara pada ti awon iye yen ko ba jo arawon. + +### Apeere + +```ts +import { toBe } from '@onyx/matchers'; + +console.log(toBe(1, 1)); // true +console.log(toBe({}, {})); // true +console.log(toBe(NaN, NaN)); // true +console.log(toBe(1, 2)); // false +console.log(toBe(NaN, null)); // false +console.log(toBe(undefined, null)); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-contain.md b/packages/docs/yor/matchers/matchers/to-contain.md new file mode 100644 index 0000000..9a54fbc --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-contain.md @@ -0,0 +1,16 @@ +## toContain + +> ibuwolu: `toContain (a: any[] | object, b: any): boolean` + +`toContain` matcher shey ayewo parameta ti akooko ni boya o wa ni inu parameta elekeji. + +### Apeere + +```ts +import { toContain } from '@onyx/matchers'; + +console.log(toContain([1], 1)); // true +console.log(toContain({a: 'b'}, 'b')); // true +console.log(toContain([{}, 1, 'onyx'], 'onyx')); // true +console.log(toContain(1 as any, 'onyx')); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-equal.md b/packages/docs/yor/matchers/matchers/to-equal.md new file mode 100644 index 0000000..874664d --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-equal.md @@ -0,0 +1,16 @@ +## toEqual + +> Ibuwolu: `toEqual (a: any, b: any): boolean` + +`toEqual` matcher ma se `type coercion` ode tun ma shey ayewo parameta ti a fun ki oba le wo bi oshey da si. + +### Apeere + +```ts +import { toEqual } from '@onyx/matchers'; + +console.log(toEqual(1, '1')); // true +console.log(toEqual('string', ['string'])); // true +console.log(toEqual('five', 5)); // false +console.log(toEqual({}, {})); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-have-length.md b/packages/docs/yor/matchers/matchers/to-have-length.md new file mode 100644 index 0000000..f72496d --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-have-length.md @@ -0,0 +1,16 @@ +## toHaveLength + +> Ibuwolu: `toHaveLength (a: any, b: number): boolean` + +`toHaveLength` matcher ma shey ayewo boya objecti ni properti length ode tun ma wo boya o se deede pelu iye o miran. + +### Apeere + +```ts +import { toHaveLength } from '@onyx/matchers'; + +console.log(toHaveLength({}, 0)); // true +console.log(toHaveLength('string', 6)); // true +console.log(toHaveLength(undefined, 1)); // false +console.log(toHaveLength(null, 1)); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-strictly-equal.md b/packages/docs/yor/matchers/matchers/to-strictly-equal.md new file mode 100644 index 0000000..569a558 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-strictly-equal.md @@ -0,0 +1,16 @@ +## toStrictlyEqual + +> Ibuwolu: `toStrictlyEqual (a: any, b: any): boolean` + +`toStrictlyEqual` matcher ma shey ayewo boya iye ti a fun yen shey deede pelu ara won ati boya iye yen je iru ikan na `value` and `type`. + +### Apeere + +```ts +import { toStrictlyEqual } from '@onyx/matchers'; + +console.log(toStrictlyEqual(0, 0)); // true +console.log(toStrictlyEqual('onyx', 'onyx')); // true +console.log(toStrictlyEqual(0, -1)); // false +console.log(toStrictlyEqual(0, '0')); // false +``` diff --git a/packages/docs/yor/matchers/matchers/to-throw.md b/packages/docs/yor/matchers/matchers/to-throw.md new file mode 100644 index 0000000..0b99267 --- /dev/null +++ b/packages/docs/yor/matchers/matchers/to-throw.md @@ -0,0 +1,18 @@ +## toThrow + +> Ibuwolu: `toThrow (a: Function, b: string | Function): boolean` + +`toThrow` matcher shey ayewo ise boya o ma so nkan jade ti a ba pe. + +### Apeere + +```ts +import { toThrow } from '@onyx/matchers'; + +const throwingFn = () => { throw new Error('error') }; + +console.log(toThrow(throwingFn, 'error')); // true +console.log(toThrow(() => throwingFn(), 'error')); // true +console.log(toThrow(() => { throw new Error('test1'); }, 'test')); // true +console.log(toThrow(() => undefined, 'test')); // false +``` diff --git a/packages/docs/yor/mock/README.md b/packages/docs/yor/mock/README.md new file mode 100644 index 0000000..0785ab1 --- /dev/null +++ b/packages/docs/yor/mock/README.md @@ -0,0 +1,4 @@ +# @onyx/mock +![Onyx logo](/onyx/onyx-logo-sm.svg) + +apo yi le fun wa ni ise ti ole je ise ti a le mocki, ti a le ji wo, ati objecti ti a le wo nkan ti o le shey, o le shey ayewo boya ati pe ise kan jade, ole shey ayewo nkan ti a pe pelu re , osi le je ki a mo nkan ti o fun wa pada. diff --git a/packages/docs/yor/mock/mock.md b/packages/docs/yor/mock/mock.md new file mode 100644 index 0000000..35829bb --- /dev/null +++ b/packages/docs/yor/mock/mock.md @@ -0,0 +1,16 @@ +## mock + +> Ibuwolu: `mock (fn: Function, cb?: (args: any[], result: any) => any): mock` + +`mock` eleyi ma fi aye sile lati fi se atunse osi ma je ki a wo iwa objecti alaye wa ati metodi ninu unit testi wa. + +### Apeere + +```ts +import { mock } from '@onyx/mock'; + +const fn = (a: number, b: number) => a + b; +const mockFn = mock(fn); + +console.log(mockFn(5, 5)); // 10 +```