Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Aug 27, 2024
1 parent fde62e0 commit 5d717ed
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 46 deletions.
1 change: 1 addition & 0 deletions src/timer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/prefer-promise-reject-errors */
import {type AnyActorRef} from 'xstate';

import {noop} from './util.js';
Expand Down
1 change: 1 addition & 0 deletions test/example-done.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const promiseLogic = fromPromise<string, string>(
clearTimeout(timeout);
// this rejection is eaten by xstate-audition
// in lieu of its own timeout error (seen below)
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
reject(signal.reason);
};

Expand Down
44 changes: 22 additions & 22 deletions test/until-emitted.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ describe('xstate-audition', () => {

describe('when called with all arguments', () => {
it('should return a value with the expected type', async () => {
const value = await runUntilEmitted(actor, EMITTER_MACHINE_TYPES);
const _value = await runUntilEmitted(actor, EMITTER_MACHINE_TYPES);

expectTypeOf<typeof value>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
ActorEmittedTuple<
Actor<typeof emitterMachine>,
typeof EMITTER_MACHINE_TYPES
Expand All @@ -70,17 +70,17 @@ describe('xstate-audition', () => {

describe('when called without arguments', () => {
it('should return itself', async () => {
const func = runUntilEmitted();
const _value = runUntilEmitted();

expectTypeOf<typeof func>().toEqualTypeOf<CurryEmitted>();
expectTypeOf<typeof _value>().toEqualTypeOf<CurryEmitted>();
});
});

describe('when called with one argument', () => {
it('should return a curried function type', async () => {
const func = runUntilEmitted(actor);
const _value = runUntilEmitted(actor);

expectTypeOf<typeof func>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
CurryEmittedP1<typeof actor>
>();
});
Expand Down Expand Up @@ -110,9 +110,9 @@ describe('xstate-audition', () => {

describe('when called with all arguments', () => {
it('should return a value with the expected type', async () => {
const value = await waitForEmitted(actor, EMITTER_MACHINE_TYPES);
const _value = await waitForEmitted(actor, EMITTER_MACHINE_TYPES);

expectTypeOf<typeof value>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
ActorEmittedTuple<
Actor<typeof emitterMachine>,
typeof EMITTER_MACHINE_TYPES
Expand All @@ -123,17 +123,17 @@ describe('xstate-audition', () => {

describe('when called without arguments', () => {
it('should return itself', () => {
const func = waitForEmitted();
const _value = waitForEmitted();

expectTypeOf<typeof func>().toEqualTypeOf<CurryEmitted>();
expectTypeOf<typeof _value>().toEqualTypeOf<CurryEmitted>();
});
});

describe('when called with one argument', () => {
it('should return a curried function type', () => {
const func = waitForEmitted(actor);
const _value = waitForEmitted(actor);

expectTypeOf<typeof func>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
CurryEmittedP1<typeof actor>
>();
});
Expand Down Expand Up @@ -173,13 +173,13 @@ describe('xstate-audition', () => {

describe('when called with all arguments', () => {
it('should return a value with the expected type', async () => {
const value = await runUntilEmittedWith(
const _value = await runUntilEmittedWith(
actor,
{},
EMITTER_MACHINE_TYPES,
);

expectTypeOf<typeof value>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
ActorEmittedTuple<
Actor<typeof emitterMachine>,
typeof EMITTER_MACHINE_TYPES
Expand All @@ -190,27 +190,27 @@ describe('xstate-audition', () => {

describe('when called without arguments', () => {
it('should return itself', async () => {
const func = runUntilEmittedWith();
const _value = runUntilEmittedWith();

expectTypeOf<typeof func>().toEqualTypeOf<CurryEmittedWith>();
expectTypeOf<typeof _value>().toEqualTypeOf<CurryEmittedWith>();
});
});

describe('when called with one argument', () => {
it('should return a curried function type', async () => {
const func = runUntilEmittedWith(actor);
const _value = runUntilEmittedWith(actor);

expectTypeOf<typeof func>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
CurryEmittedWithP1<typeof actor>
>();
});
});

describe('when called with two arguments', () => {
it('should return a curried function type', async () => {
const func = runUntilEmittedWith(actor, {});
const _value = runUntilEmittedWith(actor, {});

expectTypeOf<typeof func>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
CurryEmittedWithP2<typeof actor>
>();
});
Expand All @@ -227,13 +227,13 @@ describe('xstate-audition', () => {
it('should return a value with the expected type', async () => {
const actor = createActor(emitterMachine);

const value = await waitForEmittedWith(
const _value = await waitForEmittedWith(
actor,
{},
EMITTER_MACHINE_TYPES,
);

expectTypeOf<typeof value>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
ActorEmittedTuple<
Actor<typeof emitterMachine>,
typeof EMITTER_MACHINE_TYPES
Expand Down
4 changes: 2 additions & 2 deletions test/until-event-received.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ describe('xstate-audition', () => {

actor.send({type: 'PING'});

const value = await promise;
const _value = await promise;

expectTypeOf<typeof value>().toEqualTypeOf<[ReceiverMachineEvent]>();
expectTypeOf<typeof _value>().toEqualTypeOf<[ReceiverMachineEvent]>();
});
});
});
Expand Down
8 changes: 4 additions & 4 deletions test/until-event-sent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ describe('xstate-audition', () => {
);

it('should return a value with the expected type', async () => {
const value = await runUntilEventSent<
const _value = await runUntilEventSent<
typeof actor,
Actor<typeof receiverMachine>,
['PING']
>(actor, ['PING']);

expectTypeOf<typeof value>().toEqualTypeOf<[ReceiverMachineEvent]>();
expectTypeOf<typeof _value>().toEqualTypeOf<[ReceiverMachineEvent]>();
});
});

Expand All @@ -65,13 +65,13 @@ describe('xstate-audition', () => {
);

it('should return a value with the expected type', async () => {
const value = await waitForEventSent<
const _value = await waitForEventSent<
typeof actor,
Actor<typeof receiverMachine>,
['PING']
>(actor, ['PING']);

expectTypeOf<typeof value>().toEqualTypeOf<[ReceiverMachineEvent]>();
expectTypeOf<typeof _value>().toEqualTypeOf<[ReceiverMachineEvent]>();
});
});

Expand Down
4 changes: 2 additions & 2 deletions test/until-snapshot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ describe('xstate-audition', () => {
);

it('should return a value with the expected type', async () => {
const value = await runUntilSnapshot(
const _value = await runUntilSnapshot(
createActor(promiseLogic),
predicate,
);

expectTypeOf<typeof value>().toEqualTypeOf<
expectTypeOf<typeof _value>().toEqualTypeOf<
PromiseSnapshot<string, void>
>();
});
Expand Down
16 changes: 8 additions & 8 deletions test/until-spawn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ describe('xstate-audition', () => {
it('should return a value with the expected type', async () => {
actor = createActor(spawnerMachine);

const value = await runUntilSpawn(actor, ACTOR_ID);
const _value = await runUntilSpawn(actor, ACTOR_ID);

expectTypeOf<typeof value>().toEqualTypeOf<AnyActorRef>();
expectTypeOf<typeof _value>().toEqualTypeOf<AnyActorRef>();
});
});
});
Expand Down Expand Up @@ -106,9 +106,9 @@ describe('xstate-audition', () => {
it('should return a value with the expected type', async () => {
actor = createActor(spawnerMachine);

const value = await waitForSpawn(actor, ACTOR_ID);
const _value = await waitForSpawn(actor, ACTOR_ID);

expectTypeOf<typeof value>().toEqualTypeOf<AnyActorRef>();
expectTypeOf<typeof _value>().toEqualTypeOf<AnyActorRef>();
});
});
});
Expand Down Expand Up @@ -156,9 +156,9 @@ describe('xstate-audition', () => {
it('should return a value with the expected type', async () => {
actor = createActor(spawnerMachine);

const value = await runUntilSpawnWith(actor, {}, ACTOR_ID);
const _value = await runUntilSpawnWith(actor, {}, ACTOR_ID);

expectTypeOf<typeof value>().toEqualTypeOf<AnyActorRef>();
expectTypeOf<typeof _value>().toEqualTypeOf<AnyActorRef>();
});

it('should timeout if the actor does not complete in time', async () => {
Expand Down Expand Up @@ -224,9 +224,9 @@ describe('xstate-audition', () => {
it('should return a value with the expected type', async () => {
actor = createActor(spawnerMachine);

const value = await waitForSpawnWith(actor, {}, ACTOR_ID);
const _value = await waitForSpawnWith(actor, {}, ACTOR_ID);

expectTypeOf<typeof value>().toEqualTypeOf<AnyActorRef>();
expectTypeOf<typeof _value>().toEqualTypeOf<AnyActorRef>();
});

it('should timeout if the actor does not complete in time', async () => {
Expand Down
16 changes: 8 additions & 8 deletions test/until-transition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ describe('xstate-audition', () => {

resolver(actor);

const value = await promise;
const _value = await promise;

expectTypeOf<typeof value>().toEqualTypeOf<void>();
expectTypeOf<typeof _value>().toEqualTypeOf<void>();
});

describe('when called with an Actor that immediately throws', () => {
Expand Down Expand Up @@ -90,9 +90,9 @@ describe('xstate-audition', () => {

resolver(actor);

const value = await promise;
const _value = await promise;

expectTypeOf<typeof value>().toEqualTypeOf<void>();
expectTypeOf<typeof _value>().toEqualTypeOf<void>();
});
});

Expand All @@ -108,9 +108,9 @@ describe('xstate-audition', () => {

resolver(actor);

const value = await promise;
const _value = await promise;

expectTypeOf<typeof value>().toEqualTypeOf<void>();
expectTypeOf<typeof _value>().toEqualTypeOf<void>();
});
});

Expand All @@ -130,9 +130,9 @@ describe('xstate-audition', () => {

resolver(actor);

const value = await promise;
const _value = await promise;

expectTypeOf<typeof value>().toEqualTypeOf<void>();
expectTypeOf<typeof _value>().toEqualTypeOf<void>();
});
});
});
Expand Down

0 comments on commit 5d717ed

Please sign in to comment.