Skip to content

Commit

Permalink
docs: Fix typos (#1093)
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor authored Nov 5, 2023
1 parent ef5cd8b commit b10ac88
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions packages/context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ The context package exports these two functions:

Create context is the minimal implementation of context. It allows propagation of values down in your function call.

createContext takes a single argument - defaultContextValue. This value is used when not withing a running context.
createContext takes a single argument - defaultContextValue. This value is used when not within a running context.

### Arguments

| Argument | Type | Optional? | Description |
| ------------------- | ----- | --------- | ------------------------------------------------------------ |
| defaultContextValue | `any` | Yes | The default value to use when not withing a running context. |
| Argument | Type | Optional? | Description |
| ------------------- | ----- | --------- | ----------------------------------------------------------- |
| defaultContextValue | `any` | Yes | The default value to use when not within a running context. |

### Returned object

`createContext` returns an object containing the following functions:

- `use`: Returns the current context value, or the default value when not withing a running context.
- `use`: Returns the current context value, or the default value when not within a running context.
- `useX`: Returns the current context, throws an error if not within a running context or the context is undefined. `useX` will throw even if a default value is provided.
- `run`: Runs the context, passing the given value into the context.

**Note About Typescript Usage**
For convenience, `use` assumes we're alwyas inside a context. If you want to have runtime safety, you can use `useX` instead to make sure you're excplicitly using a defined context.
For convenience, `use` assumes we're always inside a context. If you want to have runtime safety, you can use `useX` instead to make sure you're explicitly using a defined context.

### Usage Example

Expand Down
2 changes: 1 addition & 1 deletion packages/n4s/src/plugins/schema/__tests__/loose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('enforce.loose for loose matching', () => {
});
});
describe('eager interface', () => {
it('Should return sliently return when value has non-enforced keys', () => {
it('Should return silently return when value has non-enforced keys', () => {
enforce({ username: 'ealush', age: 31, foo: 'bar' }).loose({
username: enforce.isString(),
age: enforce.isNumber(),
Expand Down
2 changes: 1 addition & 1 deletion packages/n4s/src/plugins/schema/__tests__/shape.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as ruleReturn from 'ruleReturn';
import 'schema';
import 'compounds';

describe('enforce.shape excact matching', () => {
describe('enforce.shape exact matching', () => {
describe('lazy interface', () => {
it('Should return a failing return when value has non-enforced keys', () => {
expect(
Expand Down
4 changes: 2 additions & 2 deletions packages/n4s/src/rules/__tests__/inside.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Inside rule', () => {
expect(inside(false, [true, 'one', 'two'])).toBe(false);
});

it('Should fail to find array elemets in another array in which they do not exist', () => {
it('Should fail to find array elements in another array in which they do not exist', () => {
expect(inside(['no', 'treble'], ['all', 'about', 'the', 'bass'])).toBe(
false
);
Expand All @@ -48,7 +48,7 @@ describe('Inside rule', () => {
expect(inside('Kenny', 'You Killed Kenny!')).toBe(true);
});

it('Should failt to find a string inside another string in which it does not exist', () => {
it('Should fail to find a string inside another string in which it does not exist', () => {
expect(inside('mugs', "I'm gonna pop some tags")).toBe(false);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/n4s/src/rules/__tests__/isNegative.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Tests isNegative rule', () => {
expect(isNegative(0)).toBe(false);
});
describe('When argument is a negative number', () => {
it('Should return true for negative numer', () => {
it('Should return true for negative number', () => {
expect(isNegative(-1)).toBe(true);
});
it('should return true for negative desimal number', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vest-utils/src/__tests__/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('lib: cache', () => {
});

describe('cache.invalidate', () => {
it('Should remove cached item from cache storage by its dependcies', () => {
it('Should remove cached item from cache storage by its dependencies', () => {
const deps = [1, 2, 3];
c(deps, Math.random);
expect(c.get(deps)).not.toBeNull();
Expand Down
2 changes: 1 addition & 1 deletion packages/vest-utils/src/__tests__/isPositive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Test isPositive rule', () => {
});

describe('When argument is a negative number', () => {
it('Should return false for negative numer', () => {
it('Should return false for negative number', () => {
expect(isPositive(-1)).toBe(false);
});
it('should return false for negative desimal number', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('optionalFunctionValue', () => {
expect(optionalFunctionValue(value)).toBe('return value');
expect(value).toHaveBeenCalled();
});
it('Should run with arguments arry', () => {
it('Should run with arguments array', () => {
const value = jest.fn((...args) => args.join('|'));
const args = [1, 2, 3, 4];
expect(optionalFunctionValue(value, ...args)).toBe('1|2|3|4');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('VestTest', () => {
expect(VestTest.awaitsResolution(testObject)).toBe(true);
});

it('Should retrun false for a tested test', () => {
it('Should return false for a tested test', () => {
VestTest.fail(testObject);
expect(VestTest.awaitsResolution(testObject)).toBe(false);
testObject = mockIsolateTest({ fieldName: 'f' });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useIsOptionalFiedApplied } from 'optional';
import { useIsOptionalFieldApplied } from 'optional';

import { TIsolateTest } from 'IsolateTest';
import { TFieldName } from 'SuiteResultTypes';
Expand Down Expand Up @@ -30,7 +30,7 @@ export function useVerifyTestRun(
}

function useShouldOmit(fieldName: TFieldName): boolean {
return useWithinActiveOmitWhen() || useIsOptionalFiedApplied(fieldName);
return useWithinActiveOmitWhen() || useIsOptionalFieldApplied(fieldName);
}

function skipTestAndReturn(testNode: TIsolateTest): TIsolateTest {
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/hooks/optional/optional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function optional<F extends TFieldName>(
}
}

export function useIsOptionalFiedApplied(fieldName?: TFieldName) {
export function useIsOptionalFieldApplied(fieldName?: TFieldName) {
if (!fieldName) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('hasErrorsByGroup', () => {
dummyTest.failing('field_1', 'msg');
});
});
expect(suite().hasErrorsByGroup(groupName, 'non_matcing_field')).toBe(
expect(suite().hasErrorsByGroup(groupName, 'non_matching_field')).toBe(
false
);
});
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('hasWarningsByGroup', () => {
dummyTest.failingWarning(fieldName, 'msg');
});
});
expect(suite().hasWarningsByGroup(groupName, 'non_matcing_field')).toBe(
expect(suite().hasWarningsByGroup(groupName, 'non_matching_field')).toBe(
false
);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useIsOptionalFiedApplied } from 'optional';
import { useIsOptionalFieldApplied } from 'optional';
import { VestRuntime } from 'vestjs-runtime';

import { SuiteOptionalFields, TIsolateSuite } from 'IsolateSuite';
Expand All @@ -17,7 +17,7 @@ import { nonMatchingGroupName } from 'matchingGroupName';

export function useShouldAddValidProperty(fieldName?: TFieldName): boolean {
// Is the field optional, and the optional condition is applied
if (useIsOptionalFiedApplied(fieldName)) {
if (useIsOptionalFieldApplied(fieldName)) {
return true;
}

Expand All @@ -44,7 +44,7 @@ export function useShouldAddValidPropertyInGroup(
groupName: TGroupName,
fieldName: TFieldName
): boolean {
if (useIsOptionalFiedApplied(fieldName)) {
if (useIsOptionalFieldApplied(fieldName)) {
return true;
}

Expand All @@ -66,7 +66,7 @@ function useHasNonOptionalIncomplete(fieldName?: TFieldName) {
if (nonMatchingFieldName(VestTest.getData(testObject), fieldName)) {
return false;
}
return !useIsOptionalFiedApplied(fieldName);
return !useIsOptionalFieldApplied(fieldName);
});
}

Expand All @@ -84,7 +84,7 @@ function useHasNonOptionalIncompleteByGroup(
return false;
}

return !useIsOptionalFiedApplied(fieldName);
return !useIsOptionalFieldApplied(fieldName);
});
}

Expand Down Expand Up @@ -121,7 +121,7 @@ function useNoMissingTestsLogic(
/**
* The reason we're checking for the optional field here and not in "omitOptionalFields"
* is because that unlike the bool/function check we do there, here it only depends on
* whether the field was tested alredy or not.
* whether the field was tested already or not.
*
* We qualify the test as not missing only if it was already run, if it is omitted,
* or if it is marked as optional, even if the optional check did not apply yet -
Expand Down
2 changes: 1 addition & 1 deletion packages/vestjs-runtime/src/errors/ErrorStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export enum ErrorStrings {
NO_ACTIVE_ISOLATE = 'Not within an active isolate',
UNABLE_TO_PICK_NEXT_ISOLATE = 'Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.',
ENCOUNTERED_THE_SAME_KEY_TWICE = `Encountered the same key "{key}" twice. This may lead to inconsistent or overriding of results.`,
IVALID_ISOLATE_CANNOT_PARSE = `Invalid isolate was passed to IsolateSerializer. Cannot proceed.`,
INVALID_ISOLATE_CANNOT_PARSE = `Invalid isolate was passed to IsolateSerializer. Cannot proceed.`,
}
2 changes: 1 addition & 1 deletion packages/vestjs-runtime/src/exports/IsolateSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class IsolateSerializer {
invariant(
hasOwnProperty(node, IsolateKeys.Type) ||
hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]),
text(ErrorStrings.IVALID_ISOLATE_CANNOT_PARSE)
text(ErrorStrings.INVALID_ISOLATE_CANNOT_PARSE)
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions vx/config/rollup/plugins/handleExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function writePackageJson(name, exportPath, { namespace } = {}) {
function generatePackageJson(moduleName, namespace) {
if (!isMainExport(moduleName)) {
return {
...genPackgeJsonBase(moduleName, {
...genPackageJsonBase(moduleName, {
namespace,
isNested: true,
}),
Expand All @@ -93,7 +93,7 @@ function generatePackageJson(moduleName, namespace) {
}

return {
...genPackgeJsonBase(moduleName, { namespace }),
...genPackageJsonBase(moduleName, { namespace }),
...genRepoDetails(moduleName),
exports: {
...genExportedFilesInMainPackageJson(),
Expand All @@ -102,7 +102,7 @@ function generatePackageJson(moduleName, namespace) {
};
}

function genPackgeJsonBase(moduleName, { namespace, isNested = false }) {
function genPackageJsonBase(moduleName, { namespace, isNested = false }) {
let prefix = '.';
if (isNested) {
prefix = namespace ? '../..' : '..';
Expand Down
2 changes: 1 addition & 1 deletion vx/scripts/release/steps/push_to_latest_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo "Cleaning up auth token"
yarn config unset npmAuthToken
yarn config unset npmAlwaysAuth

echo "Commiting"
echo "Committing"
git add -A
git commit -m "$1" -m "$2"

Expand Down
2 changes: 1 addition & 1 deletion website/docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 2
title: Vest's core concepts
description: Understand the core concepts of Vest and how it differs from other validation libraries.
keywords: [Vest, Core concepts, Farmework Agnostic, Validation, Suite]
keywords: [Vest, Core concepts, Framework Agnostic, Validation, Suite]
---

## Introduction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ If we want to conditionally skip a portion of our suite, we can use `skip()` wit
import { create, test, group, enforce, skip } from 'vest';

const suite = create(data => {
// We want to always run this test, even if we skip the promo_code qauntity test
// We want to always run this test, even if we skip the promo_code quantity test
test('quantity', `Quantity on this item is limited to ${data.limit}`, () => {
enforce(data.quantity).lessThanOrEquals(data.limit);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Vest allows you to provide custom messages within the test body itself. There ar

The `enforce` function in Vest allows you to pass a custom message using the `message` modifier. This can be useful if you have multiple failure conditions.

The message must be specified before the rule it refers to, because once the rule failes, enforce throws immediately.
The message must be specified before the rule it refers to, because once the rule fails, enforce throws immediately.

```js
test('username', () => {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-4.x/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 2
title: Vest's core concepts
description: Understand the core concepts of Vest and how it differs from other validation libraries.
keywords: [Vest, Core concepts, Farmework Agnostic, Validation, Suite]
keywords: [Vest, Core concepts, Framework Agnostic, Validation, Suite]
---

# Core Concepts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Sometimes your validation logic might result in different failure reasons that a

A custom message can ban passed to enforce via the `message` modifier. Multiple messages can be passed as well in case you have multiple failure conditions.

The message must be specified before the rule it refers to, because once the rule failes, enforce throws immediately.
The message must be specified before the rule it refers to, because once the rule fails, enforce throws immediately.

```js
test('username', () => {
Expand Down

0 comments on commit b10ac88

Please sign in to comment.