Skip to content

Commit

Permalink
Rename little 't' to 'of'
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinBuschmann committed Nov 1, 2023
1 parent 1fd306b commit 26a8593
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/forEachSqsRecord/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compose, types } from '../core';
import { SQSBatchResponse, SQSEvent, SQSRecord } from 'aws-lambda';
import { forEachSqsRecord } from './index';
import { t } from '../types/TypeRef';
import { of } from '../types/TypeRef';
import { mock } from '../types/mock';
import { inject } from '../inject';

Expand All @@ -22,7 +22,7 @@ describe('given batchItemFailures are expected', () => {
}),
forEachSqsRecord({
batchItemFailures: true,
bodyType: t<SomeMessageBody>,
bodyType: of<SomeMessageBody>,
}),
)(async (event) => {
if (event.record.body.shouldFail) {
Expand All @@ -45,7 +45,7 @@ describe('given batchItemFailures are expected', () => {
// @ts-expect-error
forEachSqsRecord({
batchItemFailures: false,
bodyType: t<SomeMessageBody>,
bodyType: of<SomeMessageBody>,
}),
)(async (event) => {});
});
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('given no batchItemFailures are expected', () => {
types<SQSEvent, Promise<void>>(),
forEachSqsRecord({
batchItemFailures: false,
bodyType: t<SomeMessageBody>,
bodyType: of<SomeMessageBody>,
}),
)(async (event) => {
if (event.record.body.shouldFail) {
Expand All @@ -140,7 +140,7 @@ describe('given no batchItemFailures are expected', () => {
// @ts-expect-error
forEachSqsRecord({
batchItemFailures: true,
bodyType: t<SomeMessageBody>,
bodyType: of<SomeMessageBody>,
}),
)(async (event) => {});
});
Expand Down
6 changes: 3 additions & 3 deletions src/parseJson/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { APIGatewayProxyEvent } from 'aws-lambda';
import { compose, types } from '../core';
import { parseJson } from './index';
import { t } from '../types/TypeRef';
import { of } from '../types/TypeRef';

let handler;
const body = { name: 'bob', age: 12 };
Expand All @@ -25,7 +25,7 @@ describe('given body type is specified', () => {
it('should not throw ts errors', () => {
handler = compose(
types<APIGatewayProxyEvent, any>(),
parseJson(t<{ id: string; description: string }>),
parseJson(of<{ id: string; description: string }>),
)(async (event) => {
event.jsonBody.id;
event.jsonBody.description;
Expand All @@ -36,7 +36,7 @@ describe('given body type is specified', () => {
it('should throw ts error', () => {
handler = compose(
types<APIGatewayProxyEvent, any>(),
parseJson(t<{ id: string; description: string }>),
parseJson(of<{ id: string; description: string }>),
)(async (event) => {
// @ts-expect-error
event.jsonBody.unknown;
Expand Down
6 changes: 3 additions & 3 deletions src/serializeJson/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { compose, types } from '../core';
import { APIGatewayEvent } from 'aws-lambda';
import { serializeJson } from './';
import { APIGatewayProxyResult } from '../types/APIGatewayProxyResult';
import { t } from '../types/TypeRef';
import { of } from '../types/TypeRef';

describe('given no body type is specified', () => {
const createHandler = () =>
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('given body type is specified', () => {
const createHandler = () =>
compose(
types<APIGatewayEvent, Promise<APIGatewayProxyResult>>(),
serializeJson(t<Message>),
serializeJson(of<Message>),
)(async (event) => {
return {
statusCode: 200,
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('given body type is specified but not returned properly', () => {
it('should throw ts error', () => {
compose(
types<APIGatewayEvent, Promise<APIGatewayProxyResult>>(),
serializeJson(t<{ id: string; description: string }>),
serializeJson(of<{ id: string; description: string }>),
// @ts-expect-error
)(async (event) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/types/TypeRef.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const t = <T>() => null as unknown as T;
export const of = <T>() => null as unknown as T;
export type TypeRef<T> = () => T;

0 comments on commit 26a8593

Please sign in to comment.