Skip to content

Commit

Permalink
Add test ids for generated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiggins committed Oct 13, 2023
1 parent 3e9d63e commit 8630054
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/react/runtime/test/useSignals.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
checkConsoleErrorLogs,
} from "../../test/shared/utils";

let testId = 0;
const getTestId = () => `${++testId}`.padStart(2, "0");
const MANAGED_COMPONENT = 1;
const MANAGED_HOOK = 2;

Expand Down Expand Up @@ -517,15 +519,15 @@ describe("useSignals", () => {
[ManagedComponent, UnmanagedComponent].forEach(Component => {
const componentName = Component.name;

it(`${componentName} > managed hook`, async () => {
it(`(${getTestId()}) ${componentName} > managed hook`, async () => {
await runTest(
<Component hooks={[useManagedHook]} />,
componentSignal,
managedHookSignal
);
});

it(`${componentName} > unmanaged hook`, async () => {
it(`(${getTestId()}) ${componentName} > unmanaged hook`, async () => {
await runTest(
<Component hooks={[useUnmanagedHook]} />,
componentSignal,
Expand All @@ -537,7 +539,7 @@ describe("useSignals", () => {
[ManagedComponent, UnmanagedComponent].forEach(Component => {
const componentName = Component.name;

it(`${componentName} > managed hook + managed hook`, async () => {
it(`(${getTestId()}) ${componentName} > managed hook + managed hook`, async () => {
let managedHookSignal2 = signal(0);
function useManagedHook2() {
const e = useSignals(MANAGED_HOOK);
Expand All @@ -556,7 +558,7 @@ describe("useSignals", () => {
);
});

it(`${componentName} > managed hook + unmanaged hook`, async () => {
it(`(${getTestId()}) ${componentName} > managed hook + unmanaged hook`, async () => {
await runTest(
<Component hooks={[useManagedHook, useUnmanagedHook]} />,
componentSignal,
Expand All @@ -565,7 +567,7 @@ describe("useSignals", () => {
);
});

it(`${componentName} > unmanaged hook + managed hook`, async () => {
it(`(${getTestId()}) ${componentName} > unmanaged hook + managed hook`, async () => {
await runTest(
<Component hooks={[useUnmanagedHook, useManagedHook]} />,
componentSignal,
Expand All @@ -574,7 +576,7 @@ describe("useSignals", () => {
);
});

it(`${componentName} > unmanaged hook + unmanaged hook`, async () => {
it(`(${getTestId()}) ${componentName} > unmanaged hook + unmanaged hook`, async () => {
let unmanagedHookSignal2 = signal(0);
function useUnmanagedHook2() {
useSignals();
Expand Down Expand Up @@ -620,7 +622,7 @@ describe("useSignals", () => {
[ManagedComponent, UnmanagedComponent].forEach(Component => {
const componentName = Component.name;

it(`${componentName} > managed hook > managed hook`, async () => {
it(`(${getTestId()}) ${componentName} > managed hook > managed hook`, async () => {
let managedHookSignal2 = signal(0);
function useManagedHook() {
const e = useSignals(MANAGED_HOOK);
Expand Down Expand Up @@ -650,7 +652,7 @@ describe("useSignals", () => {
);
});

it(`${componentName} > managed hook > unmanaged hook`, async () => {
it(`(${getTestId()}) ${componentName} > managed hook > unmanaged hook`, async () => {
let unmanagedHookSignal = signal(0);
function useUnmanagedHook() {
useSignals();
Expand All @@ -676,7 +678,7 @@ describe("useSignals", () => {
);
});

it(`${componentName} > unmanaged hook > managed hook`, async () => {
it(`(${getTestId()}) ${componentName} > unmanaged hook > managed hook`, async () => {
let managedHookSignal = signal(0);
function useManagedHook() {
const e = useSignals(MANAGED_HOOK);
Expand All @@ -702,7 +704,7 @@ describe("useSignals", () => {
);
});

it(`${componentName} > unmanaged hook > unmanaged hook`, async () => {
it(`(${getTestId()}) ${componentName} > unmanaged hook > unmanaged hook`, async () => {
let unmanagedHookSignal2 = signal(0);
function useUnmanagedHook() {
useSignals();
Expand Down

0 comments on commit 8630054

Please sign in to comment.