Skip to content

Commit 95f21f4

Browse files
committed
run Prettier
1 parent 9b8e08e commit 95f21f4

15 files changed

+34
-41
lines changed

tests/computed.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Computed", () => {
55
it("should work", () => {
@@ -71,5 +71,4 @@ describe("Computed", () => {
7171
expect(calls).toBe(2);
7272
});
7373
});
74-
7574
});

tests/currentComputed.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("currentComputed", () => {
55
it("works", () => {
@@ -12,4 +12,3 @@ describe("currentComputed", () => {
1212
expect(c).toBe(context);
1313
});
1414
});
15-

tests/custom-equality.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it, vi } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Custom equality", () => {
55
it("works for State", () => {
@@ -71,7 +71,7 @@ describe("Custom equality", () => {
7171
const cutoff = vi.fn((a, b) => Math.abs(a - b) < epsilon.get());
7272
const innerFn = vi.fn(() => exact.get());
7373
const inner = new Signal.Computed(innerFn, {
74-
equals: cutoff
74+
equals: cutoff,
7575
});
7676

7777
const outerFn = vi.fn(() => {
@@ -88,7 +88,7 @@ describe("Custom equality", () => {
8888

8989
exact.set(2);
9090
counter.set(2);
91-
outer.get()
91+
outer.get();
9292

9393
// `outer` reruns because `counter` changed, `inner` reruns when called by
9494
// `outer`, and `cutoff` is called for the first time.

tests/cycles.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Cycles", () => {
55
it("detects trivial cycles", () => {
@@ -14,4 +14,3 @@ describe("Cycles", () => {
1414
expect(() => c3.get()).toThrow();
1515
});
1616
});
17-

tests/dynamic-dependencies.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Dynamic dependencies", () => {
55
function run(live) {
@@ -11,7 +11,7 @@ describe("Dynamic dependencies", () => {
1111
return str;
1212
});
1313
if (live) {
14-
const w = new Signal.subtle.Watcher(() => { });
14+
const w = new Signal.subtle.Watcher(() => {});
1515
w.watch(computed);
1616
}
1717
expect(computed.get()).toBe("abcdefgh");
@@ -34,4 +34,3 @@ describe("Dynamic dependencies", () => {
3434
it("works live", () => run(true));
3535
it("works not live", () => run(false));
3636
});
37-

tests/errors.test.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { afterEach, describe, expect, it, vi } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Errors", () => {
55
it("are cached by computed signals", () => {
@@ -40,7 +40,7 @@ describe("Errors", () => {
4040
n++;
4141
throw s.get();
4242
});
43-
const w = new Signal.subtle.Watcher(() => { });
43+
const w = new Signal.subtle.Watcher(() => {});
4444
w.watch(c);
4545

4646
expect(n).toBe(0);
@@ -59,7 +59,9 @@ describe("Errors", () => {
5959
const s = new Signal.State(0);
6060
const cSpy = vi.fn(() => s.get());
6161
const c = new Signal.Computed(cSpy, {
62-
equals() { throw new Error("equals"); },
62+
equals() {
63+
throw new Error("equals");
64+
},
6365
});
6466

6567
c.get();
@@ -70,5 +72,5 @@ describe("Errors", () => {
7072
expect(cSpy).toBeCalledTimes(2);
7173
expect(() => c.get()).toThrowError("equals");
7274
expect(cSpy).toBeCalledTimes(2);
73-
})
75+
});
7476
});

tests/liveness.test.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it, vi } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("liveness", () => {
55
it("only changes on first and last descendant", () => {
@@ -14,8 +14,8 @@ describe("liveness", () => {
1414
expect(watchedSpy).not.toBeCalled();
1515
expect(unwatchedSpy).not.toBeCalled();
1616

17-
const w = new Signal.subtle.Watcher(() => { });
18-
const w2 = new Signal.subtle.Watcher(() => { });
17+
const w = new Signal.subtle.Watcher(() => {});
18+
const w2 = new Signal.subtle.Watcher(() => {});
1919

2020
w.watch(computed);
2121
expect(watchedSpy).toBeCalledTimes(1);
@@ -47,7 +47,7 @@ describe("liveness", () => {
4747
expect(watchedSpy).not.toBeCalled();
4848
expect(unwatchedSpy).not.toBeCalled();
4949

50-
const w = new Signal.subtle.Watcher(() => { });
50+
const w = new Signal.subtle.Watcher(() => {});
5151
w.watch(c);
5252
expect(watchedSpy).toBeCalledTimes(1);
5353
expect(unwatchedSpy).not.toBeCalled();
@@ -57,4 +57,3 @@ describe("liveness", () => {
5757
expect(unwatchedSpy).toBeCalledTimes(1);
5858
});
5959
});
60-

tests/prohibited-contexts.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Prohibited contexts", () => {
55
it("allows writes during computed", () => {
@@ -37,4 +37,3 @@ describe("Prohibited contexts", () => {
3737
expect(() => s.set(3)).not.toThrow();
3838
});
3939
});
40-

tests/pruning.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Pruning", () => {
55
it("only recalculates until things are equal", () => {
@@ -38,7 +38,7 @@ describe("Pruning", () => {
3838
const c2 = new Signal.Computed(() => (n2++, c.get(), 5));
3939
let n3 = 0;
4040
const c3 = new Signal.Computed(() => (n3++, c2.get()));
41-
const w = new Signal.subtle.Watcher(() => { });
41+
const w = new Signal.subtle.Watcher(() => {});
4242
w.watch(c3);
4343

4444
expect(n).toBe(0);
@@ -65,4 +65,3 @@ describe("Pruning", () => {
6565
expect(w.getPending().length).toBe(0);
6666
});
6767
});
68-

tests/receivers.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Receivers", () => {
55
it("is this for computed", () => {
66
let receiver;
7-
const c = new Signal.Computed(function() {
7+
const c = new Signal.Computed(function () {
88
receiver = this;
99
});
1010
expect(c.get()).toBe(undefined);
@@ -22,7 +22,7 @@ describe("Receivers", () => {
2222
});
2323
expect(r1).toBe(undefined);
2424
expect(r2).toBe(undefined);
25-
const w = new Signal.subtle.Watcher(() => { });
25+
const w = new Signal.subtle.Watcher(() => {});
2626
w.watch(s);
2727
expect(r1).toBe(s);
2828
expect(r2).toBe(undefined);

tests/state.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Signal.State", () => {
55
it("should work", () => {

tests/type-checking.test.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Expected class shape", () => {
55
it("should be on the prototype", () => {
@@ -16,8 +16,8 @@ describe("type checks", () => {
1616
it("checks types in methods", () => {
1717
let x = {};
1818
let s = new Signal.State(1);
19-
let c = new Signal.Computed(() => { });
20-
let w = new Signal.subtle.Watcher(() => { });
19+
let c = new Signal.Computed(() => {});
20+
let w = new Signal.subtle.Watcher(() => {});
2121

2222
expect(() => Signal.State.prototype.get.call(x)).toThrowError(TypeError);
2323
expect(Signal.State.prototype.get.call(s)).toBe(1);
@@ -97,4 +97,3 @@ describe("type checks", () => {
9797
expect(() => Signal.subtle.introspectSinks(w)).toThrowError(TypeError);
9898
});
9999
});
100-

tests/untrack.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Untrack", () => {
55
it("works", () => {

tests/watch-unwatch.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("watch and unwatch", () => {
55
it("handles multiple watchers well", () => {

tests/watcher.test.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { afterEach, describe, expect, it, vi } from "vitest";
2-
import { Signal } from '../src/wrapper.js';
2+
import { Signal } from "../src/wrapper.js";
33

44
describe("Watcher", () => {
55
type Destructor = () => void;
@@ -61,7 +61,7 @@ describe("Watcher", () => {
6161
output = stateSignal.get();
6262
computedOutput = computedSignal.get();
6363
calls++;
64-
return () => { };
64+
return () => {};
6565
});
6666

6767
// The signal is now watched
@@ -142,18 +142,17 @@ describe("Watcher", () => {
142142
// Adding any other effect after an unwatch should work as expected
143143
const destructor2 = effect(() => {
144144
output = stateSignal.get();
145-
return () => { };
145+
return () => {};
146146
});
147147

148148
stateSignal.set(300);
149149
flushPending();
150-
151150
});
152151

153152
it("provides `this` to notify as normal function", () => {
154153
const mockGetPending = vi.fn();
155154

156-
const watcher = new Signal.subtle.Watcher(function() {
155+
const watcher = new Signal.subtle.Watcher(function () {
157156
this.getPending();
158157
});
159158
watcher.getPending = mockGetPending;

0 commit comments

Comments
 (0)