From b10ac885105ba655817ce26f24707f07cf30280d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 5 Nov 2023 20:52:09 +0100 Subject: [PATCH] docs: Fix typos (#1093) --- packages/context/README.md | 12 ++++++------ .../n4s/src/plugins/schema/__tests__/loose.test.ts | 2 +- .../n4s/src/plugins/schema/__tests__/shape.test.ts | 2 +- packages/n4s/src/rules/__tests__/inside.test.ts | 4 ++-- packages/n4s/src/rules/__tests__/isNegative.test.ts | 2 +- packages/vest-utils/src/__tests__/cache.test.ts | 2 +- packages/vest-utils/src/__tests__/isPositive.test.ts | 2 +- .../src/__tests__/optionalFunctionValue.test.ts | 2 +- .../IsolateTest/__tests__/VestTestInspector.test.ts | 2 +- .../core/test/testLevelFlowControl/verifyTestRun.ts | 4 ++-- packages/vest/src/hooks/optional/optional.ts | 2 +- .../selectors/__tests__/hasFailuresByGroup.test.ts | 4 ++-- .../suiteResult/selectors/shouldAddValidProperty.ts | 12 ++++++------ packages/vestjs-runtime/src/errors/ErrorStrings.ts | 2 +- .../vestjs-runtime/src/exports/IsolateSerializer.ts | 2 +- vx/config/rollup/plugins/handleExports.js | 6 +++--- vx/scripts/release/steps/push_to_latest_branch.sh | 2 +- website/docs/concepts.md | 2 +- .../advanced_test_features/grouping_tests.md | 2 +- .../writing_tests/failing_with_a_custom_message.md | 2 +- website/versioned_docs/version-4.x/concepts.md | 2 +- .../writing_tests/failing_with_a_custom_message.md | 2 +- 22 files changed, 37 insertions(+), 37 deletions(-) diff --git a/packages/context/README.md b/packages/context/README.md index c2ecdc820..0c61f2ba4 100644 --- a/packages/context/README.md +++ b/packages/context/README.md @@ -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 diff --git a/packages/n4s/src/plugins/schema/__tests__/loose.test.ts b/packages/n4s/src/plugins/schema/__tests__/loose.test.ts index 53ef9e4a4..2f1590c83 100644 --- a/packages/n4s/src/plugins/schema/__tests__/loose.test.ts +++ b/packages/n4s/src/plugins/schema/__tests__/loose.test.ts @@ -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(), diff --git a/packages/n4s/src/plugins/schema/__tests__/shape.test.ts b/packages/n4s/src/plugins/schema/__tests__/shape.test.ts index 72dfacd88..b3dd49298 100644 --- a/packages/n4s/src/plugins/schema/__tests__/shape.test.ts +++ b/packages/n4s/src/plugins/schema/__tests__/shape.test.ts @@ -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( diff --git a/packages/n4s/src/rules/__tests__/inside.test.ts b/packages/n4s/src/rules/__tests__/inside.test.ts index 6c2865f08..e855cbbfd 100644 --- a/packages/n4s/src/rules/__tests__/inside.test.ts +++ b/packages/n4s/src/rules/__tests__/inside.test.ts @@ -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 ); @@ -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); }); diff --git a/packages/n4s/src/rules/__tests__/isNegative.test.ts b/packages/n4s/src/rules/__tests__/isNegative.test.ts index dac641409..192cbd5e5 100644 --- a/packages/n4s/src/rules/__tests__/isNegative.test.ts +++ b/packages/n4s/src/rules/__tests__/isNegative.test.ts @@ -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', () => { diff --git a/packages/vest-utils/src/__tests__/cache.test.ts b/packages/vest-utils/src/__tests__/cache.test.ts index 7089d9f66..d8eae24e1 100644 --- a/packages/vest-utils/src/__tests__/cache.test.ts +++ b/packages/vest-utils/src/__tests__/cache.test.ts @@ -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(); diff --git a/packages/vest-utils/src/__tests__/isPositive.test.ts b/packages/vest-utils/src/__tests__/isPositive.test.ts index b4b7d27ea..f6cb36fc3 100644 --- a/packages/vest-utils/src/__tests__/isPositive.test.ts +++ b/packages/vest-utils/src/__tests__/isPositive.test.ts @@ -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', () => { diff --git a/packages/vest-utils/src/__tests__/optionalFunctionValue.test.ts b/packages/vest-utils/src/__tests__/optionalFunctionValue.test.ts index 3774847fa..ec973a01f 100644 --- a/packages/vest-utils/src/__tests__/optionalFunctionValue.test.ts +++ b/packages/vest-utils/src/__tests__/optionalFunctionValue.test.ts @@ -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'); diff --git a/packages/vest/src/core/isolate/IsolateTest/__tests__/VestTestInspector.test.ts b/packages/vest/src/core/isolate/IsolateTest/__tests__/VestTestInspector.test.ts index 7dc617280..167c47d06 100644 --- a/packages/vest/src/core/isolate/IsolateTest/__tests__/VestTestInspector.test.ts +++ b/packages/vest/src/core/isolate/IsolateTest/__tests__/VestTestInspector.test.ts @@ -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' }); diff --git a/packages/vest/src/core/test/testLevelFlowControl/verifyTestRun.ts b/packages/vest/src/core/test/testLevelFlowControl/verifyTestRun.ts index 715139286..2114a3865 100644 --- a/packages/vest/src/core/test/testLevelFlowControl/verifyTestRun.ts +++ b/packages/vest/src/core/test/testLevelFlowControl/verifyTestRun.ts @@ -1,4 +1,4 @@ -import { useIsOptionalFiedApplied } from 'optional'; +import { useIsOptionalFieldApplied } from 'optional'; import { TIsolateTest } from 'IsolateTest'; import { TFieldName } from 'SuiteResultTypes'; @@ -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 { diff --git a/packages/vest/src/hooks/optional/optional.ts b/packages/vest/src/hooks/optional/optional.ts index 49645ce2e..ac9bc745e 100644 --- a/packages/vest/src/hooks/optional/optional.ts +++ b/packages/vest/src/hooks/optional/optional.ts @@ -54,7 +54,7 @@ export function optional( } } -export function useIsOptionalFiedApplied(fieldName?: TFieldName) { +export function useIsOptionalFieldApplied(fieldName?: TFieldName) { if (!fieldName) { return false; } diff --git a/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts b/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts index dbce3e246..aee2e3484 100644 --- a/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts +++ b/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts @@ -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 ); }); @@ -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 ); }); diff --git a/packages/vest/src/suiteResult/selectors/shouldAddValidProperty.ts b/packages/vest/src/suiteResult/selectors/shouldAddValidProperty.ts index b40772596..08cba75b8 100644 --- a/packages/vest/src/suiteResult/selectors/shouldAddValidProperty.ts +++ b/packages/vest/src/suiteResult/selectors/shouldAddValidProperty.ts @@ -1,4 +1,4 @@ -import { useIsOptionalFiedApplied } from 'optional'; +import { useIsOptionalFieldApplied } from 'optional'; import { VestRuntime } from 'vestjs-runtime'; import { SuiteOptionalFields, TIsolateSuite } from 'IsolateSuite'; @@ -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; } @@ -44,7 +44,7 @@ export function useShouldAddValidPropertyInGroup( groupName: TGroupName, fieldName: TFieldName ): boolean { - if (useIsOptionalFiedApplied(fieldName)) { + if (useIsOptionalFieldApplied(fieldName)) { return true; } @@ -66,7 +66,7 @@ function useHasNonOptionalIncomplete(fieldName?: TFieldName) { if (nonMatchingFieldName(VestTest.getData(testObject), fieldName)) { return false; } - return !useIsOptionalFiedApplied(fieldName); + return !useIsOptionalFieldApplied(fieldName); }); } @@ -84,7 +84,7 @@ function useHasNonOptionalIncompleteByGroup( return false; } - return !useIsOptionalFiedApplied(fieldName); + return !useIsOptionalFieldApplied(fieldName); }); } @@ -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 - diff --git a/packages/vestjs-runtime/src/errors/ErrorStrings.ts b/packages/vestjs-runtime/src/errors/ErrorStrings.ts index ca1f76373..378fba1cc 100644 --- a/packages/vestjs-runtime/src/errors/ErrorStrings.ts +++ b/packages/vestjs-runtime/src/errors/ErrorStrings.ts @@ -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.`, } diff --git a/packages/vestjs-runtime/src/exports/IsolateSerializer.ts b/packages/vestjs-runtime/src/exports/IsolateSerializer.ts index 217336297..09047cdee 100644 --- a/packages/vestjs-runtime/src/exports/IsolateSerializer.ts +++ b/packages/vestjs-runtime/src/exports/IsolateSerializer.ts @@ -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) ); } } diff --git a/vx/config/rollup/plugins/handleExports.js b/vx/config/rollup/plugins/handleExports.js index aa60bcb1e..0d5ce6a75 100644 --- a/vx/config/rollup/plugins/handleExports.js +++ b/vx/config/rollup/plugins/handleExports.js @@ -84,7 +84,7 @@ function writePackageJson(name, exportPath, { namespace } = {}) { function generatePackageJson(moduleName, namespace) { if (!isMainExport(moduleName)) { return { - ...genPackgeJsonBase(moduleName, { + ...genPackageJsonBase(moduleName, { namespace, isNested: true, }), @@ -93,7 +93,7 @@ function generatePackageJson(moduleName, namespace) { } return { - ...genPackgeJsonBase(moduleName, { namespace }), + ...genPackageJsonBase(moduleName, { namespace }), ...genRepoDetails(moduleName), exports: { ...genExportedFilesInMainPackageJson(), @@ -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 ? '../..' : '..'; diff --git a/vx/scripts/release/steps/push_to_latest_branch.sh b/vx/scripts/release/steps/push_to_latest_branch.sh index c78037027..0fa72f7bb 100644 --- a/vx/scripts/release/steps/push_to_latest_branch.sh +++ b/vx/scripts/release/steps/push_to_latest_branch.sh @@ -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" diff --git a/website/docs/concepts.md b/website/docs/concepts.md index 9bfe7984e..bf033752b 100644 --- a/website/docs/concepts.md +++ b/website/docs/concepts.md @@ -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 diff --git a/website/docs/writing_tests/advanced_test_features/grouping_tests.md b/website/docs/writing_tests/advanced_test_features/grouping_tests.md index 2e514d8e4..41a09e439 100644 --- a/website/docs/writing_tests/advanced_test_features/grouping_tests.md +++ b/website/docs/writing_tests/advanced_test_features/grouping_tests.md @@ -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); }); diff --git a/website/docs/writing_tests/failing_with_a_custom_message.md b/website/docs/writing_tests/failing_with_a_custom_message.md index 7fe819371..cea68f15e 100644 --- a/website/docs/writing_tests/failing_with_a_custom_message.md +++ b/website/docs/writing_tests/failing_with_a_custom_message.md @@ -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', () => { diff --git a/website/versioned_docs/version-4.x/concepts.md b/website/versioned_docs/version-4.x/concepts.md index ee810bb4f..bcaef096c 100644 --- a/website/versioned_docs/version-4.x/concepts.md +++ b/website/versioned_docs/version-4.x/concepts.md @@ -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 diff --git a/website/versioned_docs/version-4.x/writing_tests/failing_with_a_custom_message.md b/website/versioned_docs/version-4.x/writing_tests/failing_with_a_custom_message.md index d91b8037a..49442575f 100644 --- a/website/versioned_docs/version-4.x/writing_tests/failing_with_a_custom_message.md +++ b/website/versioned_docs/version-4.x/writing_tests/failing_with_a_custom_message.md @@ -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', () => {