Skip to content

Commit 8f8aa13

Browse files
committed
style: 💄 run Prettier
1 parent c798c03 commit 8f8aa13

File tree

3 files changed

+112
-87
lines changed

3 files changed

+112
-87
lines changed

src/reactive-rpc/common/rpc/caller/error/RpcError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class RpcError extends Error implements IRpcError {
3939
return RpcError.internal();
4040
}
4141

42-
public static fromCode(errno: RpcErrorCodes, message: string = '', meta: unknown = undefined): RpcError{
42+
public static fromCode(errno: RpcErrorCodes, message: string = '', meta: unknown = undefined): RpcError {
4343
const code = RpcErrorCodes[errno];
4444
return new RpcError(message || code, code, errno, undefined, meta || undefined);
4545
}

src/server/__tests__/blocks.spec.ts

Lines changed: 110 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,35 @@ describe('blocks.*', () => {
9191
text: 'Hell',
9292
});
9393
const patch1 = model.api.flush();
94-
await call('blocks.create', {id, patches: [
95-
{
96-
seq: 0,
97-
created: Date.now(),
98-
blob: patch1.toBinary(),
99-
},
100-
]});
94+
await call('blocks.create', {
95+
id,
96+
patches: [
97+
{
98+
seq: 0,
99+
created: Date.now(),
100+
blob: patch1.toBinary(),
101+
},
102+
],
103+
});
101104
model.api.str(['text']).ins(4, 'o');
102105
const patch2 = model.api.flush();
103106
model.api.str(['text']).ins(5, ' World');
104107
const patch3 = model.api.flush();
105-
await call('blocks.edit', {id, patches: [
106-
{
107-
seq: 1,
108-
created: Date.now(),
109-
blob: patch2.toBinary(),
110-
},
111-
{
112-
seq: 2,
113-
created: Date.now(),
114-
blob: patch3.toBinary(),
115-
},
116-
]});
108+
await call('blocks.edit', {
109+
id,
110+
patches: [
111+
{
112+
seq: 1,
113+
created: Date.now(),
114+
blob: patch2.toBinary(),
115+
},
116+
{
117+
seq: 2,
118+
created: Date.now(),
119+
blob: patch3.toBinary(),
120+
},
121+
],
122+
});
117123
const block2 = await call('blocks.get', {id});
118124
expect(Model.fromBinary(block2.block.blob).view()).toStrictEqual({
119125
text: 'Hello World',
@@ -122,18 +128,21 @@ describe('blocks.*', () => {
122128
const patch4 = model.api.flush();
123129
model.api.str(['text']).ins(12, '!');
124130
const patch5 = model.api.flush();
125-
await call('blocks.edit', {id, patches: [
126-
{
127-
seq: 3,
128-
created: Date.now(),
129-
blob: patch4.toBinary(),
130-
},
131-
{
132-
seq: 4,
133-
created: Date.now(),
134-
blob: patch5.toBinary(),
135-
},
136-
]});
131+
await call('blocks.edit', {
132+
id,
133+
patches: [
134+
{
135+
seq: 3,
136+
created: Date.now(),
137+
blob: patch4.toBinary(),
138+
},
139+
{
140+
seq: 4,
141+
created: Date.now(),
142+
blob: patch5.toBinary(),
143+
},
144+
],
145+
});
137146
const block3 = await call('blocks.get', {id});
138147
expect(Model.fromBinary(block3.block.blob).view()).toStrictEqual({
139148
text: 'Hello, World!',
@@ -150,26 +159,32 @@ describe('blocks.*', () => {
150159
text: 'Hell',
151160
});
152161
const patch1 = model.api.flush();
153-
await call('blocks.create', {id, patches: [
154-
{
155-
seq: 0,
156-
created: Date.now(),
157-
blob: patch1.toBinary(),
158-
},
159-
]});
162+
await call('blocks.create', {
163+
id,
164+
patches: [
165+
{
166+
seq: 0,
167+
created: Date.now(),
168+
blob: patch1.toBinary(),
169+
},
170+
],
171+
});
160172

161173
// User 2
162174
const block2 = await call('blocks.get', {id});
163175
const model2 = Model.fromBinary(block2.block.blob).fork();
164176
model2.api.str(['text']).ins(4, ' yeah!');
165177
const patch2User2 = model2.api.flush();
166-
await call('blocks.edit', {id, patches: [
167-
{
168-
seq: 1,
169-
created: Date.now(),
170-
blob: patch2User2.toBinary(),
171-
},
172-
]});
178+
await call('blocks.edit', {
179+
id,
180+
patches: [
181+
{
182+
seq: 1,
183+
created: Date.now(),
184+
blob: patch2User2.toBinary(),
185+
},
186+
],
187+
});
173188
expect(model2.view()).toStrictEqual({text: 'Hell yeah!'});
174189

175190
const block3 = await call('blocks.get', {id});
@@ -181,18 +196,21 @@ describe('blocks.*', () => {
181196
const patch2 = model.api.flush();
182197
model.api.str(['text']).ins(5, ' World');
183198
const patch3 = model.api.flush();
184-
const {patches} = await call('blocks.edit', {id, patches: [
185-
{
186-
seq: 1,
187-
created: Date.now(),
188-
blob: patch2.toBinary(),
189-
},
190-
{
191-
seq: 2,
192-
created: Date.now(),
193-
blob: patch3.toBinary(),
194-
},
195-
]});
199+
const {patches} = await call('blocks.edit', {
200+
id,
201+
patches: [
202+
{
203+
seq: 1,
204+
created: Date.now(),
205+
blob: patch2.toBinary(),
206+
},
207+
{
208+
seq: 2,
209+
created: Date.now(),
210+
blob: patch3.toBinary(),
211+
},
212+
],
213+
});
196214

197215
const block4 = await call('blocks.get', {id});
198216
const model4 = Model.fromBinary(block4.block.blob).fork();
@@ -209,44 +227,53 @@ describe('blocks.*', () => {
209227
text: 'Hell',
210228
});
211229
const patch1 = model.api.flush();
212-
await call('blocks.create', {id, patches: [
213-
{
214-
seq: 0,
215-
created: Date.now(),
216-
blob: patch1.toBinary(),
217-
},
218-
]});
230+
await call('blocks.create', {
231+
id,
232+
patches: [
233+
{
234+
seq: 0,
235+
created: Date.now(),
236+
blob: patch1.toBinary(),
237+
},
238+
],
239+
});
219240

220241
// User 2
221242
const block2 = await call('blocks.get', {id});
222243
const model2 = Model.fromBinary(block2.block.blob).fork();
223244
model2.api.str(['text']).ins(4, ' yeah!');
224245
const patch2User2 = model2.api.flush();
225-
await call('blocks.edit', {id, patches: [
226-
{
227-
seq: 1,
228-
created: Date.now(),
229-
blob: patch2User2.toBinary(),
230-
},
231-
]});
246+
await call('blocks.edit', {
247+
id,
248+
patches: [
249+
{
250+
seq: 1,
251+
created: Date.now(),
252+
blob: patch2User2.toBinary(),
253+
},
254+
],
255+
});
232256

233257
// User 1
234258
model.api.str(['text']).ins(4, 'o');
235259
const patch2 = model.api.flush();
236260
model.api.str(['text']).ins(5, ' World');
237261
const patch3 = model.api.flush();
238-
const {patches} = await call('blocks.edit', {id, patches: [
239-
{
240-
seq: 1,
241-
created: Date.now(),
242-
blob: patch2.toBinary(),
243-
},
244-
{
245-
seq: 2,
246-
created: Date.now(),
247-
blob: patch3.toBinary(),
248-
},
249-
]});
262+
const {patches} = await call('blocks.edit', {
263+
id,
264+
patches: [
265+
{
266+
seq: 1,
267+
created: Date.now(),
268+
blob: patch2.toBinary(),
269+
},
270+
{
271+
seq: 2,
272+
created: Date.now(),
273+
blob: patch3.toBinary(),
274+
},
275+
],
276+
});
250277
expect(patches.length).toBe(3);
251278
expect(patches[0].seq).toBe(1);
252279
expect(patches[1].seq).toBe(2);

src/server/routes/blocks/methods/get.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ export const get =
1414
}),
1515
);
1616

17-
const Response = t.Object(
18-
t.prop('block', t.Ref<typeof Block>('Block').options({})),
19-
);
17+
const Response = t.Object(t.prop('block', t.Ref<typeof Block>('Block').options({})));
2018

2119
const Func = t
2220
.Function(Request, Response)

0 commit comments

Comments
 (0)