Skip to content

Commit

Permalink
chore: apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Oct 21, 2023
1 parent c744ffa commit e7a4054
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions test/fixture/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, it } from "vitest";
import { EventHandler, EventHandlerRequest, defineEventHandler } from "h3";
import { $Fetch } from "../..";
import { defineNitroConfig } from "../../src/config";
import { Serialize, Simplify } from "../../src/types"
import { Serialize, Simplify } from "../../src/types";

interface TestResponse {
message: string;
Expand Down Expand Up @@ -309,16 +309,26 @@ describe("defineCachedEventHandler", () => {
});
});

describe('type helpers', () => {
it('Serialize', () => {
expectTypeOf<Serialize<{ test: Date }>>().toEqualTypeOf<{ test: string }>()
expectTypeOf<Serialize<{ test: Map<string, string> }>>().toEqualTypeOf<{ test: Record<string, never> }>()
expectTypeOf<Serialize<{ nested: { test: Map<string, string> } }>>().toEqualTypeOf<{ nested: { test: Record<string, never> } }>()
})
describe("type helpers", () => {
it("Serialize", () => {
expectTypeOf<Serialize<{ test: Date }>>().toEqualTypeOf<{ test: string }>();
expectTypeOf<Serialize<{ test: Map<string, string> }>>().toEqualTypeOf<{
test: Record<string, never>;
}>();
expectTypeOf<
Serialize<{ nested: { test: Map<string, string> } }>
>().toEqualTypeOf<{ nested: { test: Record<string, never> } }>();
});

it('Simplify', () => {
expectTypeOf<Simplify<Serialize<{ test: Date }>>>().toEqualTypeOf<{ test: string }>()
expectTypeOf<Simplify<Serialize<{ test: Map<string, string> }>>>().toEqualTypeOf<{ test: Record<string, never> }>()
expectTypeOf<Simplify<Serialize<{ nested: { test: Map<string, string> } }>>>().toEqualTypeOf<{ nested: { test: Record<string, never> } }>()
})
})
it("Simplify", () => {
expectTypeOf<Simplify<Serialize<{ test: Date }>>>().toEqualTypeOf<{
test: string;
}>();
expectTypeOf<
Simplify<Serialize<{ test: Map<string, string> }>>
>().toEqualTypeOf<{ test: Record<string, never> }>();
expectTypeOf<
Simplify<Serialize<{ nested: { test: Map<string, string> } }>>
>().toEqualTypeOf<{ nested: { test: Record<string, never> } }>();
});
});

0 comments on commit e7a4054

Please sign in to comment.