Skip to content

Commit fd3e48d

Browse files
committed
chore: run npm run prettier:fix
1 parent 69573cd commit fd3e48d

File tree

6 files changed

+40
-34
lines changed

6 files changed

+40
-34
lines changed

deltachat-jsonrpc/typescript/report_api_coverage.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ const json = JSON.parse(readFileSync("./coverage/coverage-final.json"));
55
const jsonCoverage =
66
json[Object.keys(json).find((k) => k.includes(generatedFile))];
77
const fnMap = Object.keys(jsonCoverage.fnMap).map(
8-
(key) => jsonCoverage.fnMap[key]
8+
(key) => jsonCoverage.fnMap[key],
99
);
1010
const htmlCoverage = readFileSync(
1111
"./coverage/" + generatedFile + ".html",
12-
"utf8"
12+
"utf8",
1313
);
1414
const uncoveredLines = htmlCoverage
1515
.split("\n")
1616
.filter((line) => line.includes(`"function not covered"`));
1717
const uncoveredFunctions = uncoveredLines.map(
18-
(line) => />([\w_]+)\(/.exec(line)[1]
18+
(line) => />([\w_]+)\(/.exec(line)[1],
1919
);
2020
console.log(
2121
"\nUncovered api functions:\n" +
2222
uncoveredFunctions
2323
.map((uF) => fnMap.find(({ name }) => name === uF))
2424
.map(
25-
({ name, line }) => `.${name.padEnd(40)} (${generatedFile}:${line})`
25+
({ name, line }) => `.${name.padEnd(40)} (${generatedFile}:${line})`,
2626
)
27-
.join("\n")
27+
.join("\n"),
2828
);

deltachat-jsonrpc/typescript/scripts/generate-constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ while (null != (match = regex.exec(header_data))) {
2424

2525
const constants = data
2626
.filter(
27-
({ key }) => key.toUpperCase()[0] === key[0] // check if define name is uppercase
27+
({ key }) => key.toUpperCase()[0] === key[0], // check if define name is uppercase
2828
)
2929
.sort((lhs, rhs) => {
3030
if (lhs.key < rhs.key) return -1;
@@ -50,5 +50,5 @@ const constants = data
5050

5151
writeFileSync(
5252
resolve(__dirname, "../generated/constants.ts"),
53-
`// Generated!\n\nexport enum C {\n${constants.replace(/:/g, " =")},\n}\n`
53+
`// Generated!\n\nexport enum C {\n${constants.replace(/:/g, " =")},\n}\n`,
5454
);

deltachat-jsonrpc/typescript/src/client.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import { TinyEmitter } from "@deltachat/tiny-emitter";
88
type Events = { ALL: (accountId: number, event: EventType) => void } & {
99
[Property in EventType["kind"]]: (
1010
accountId: number,
11-
event: Extract<EventType, { kind: Property }>
11+
event: Extract<EventType, { kind: Property }>,
1212
) => void;
1313
};
1414

1515
type ContextEvents = { ALL: (event: EventType) => void } & {
1616
[Property in EventType["kind"]]: (
17-
event: Extract<EventType, { kind: Property }>
17+
event: Extract<EventType, { kind: Property }>,
1818
) => void;
1919
};
2020

@@ -25,7 +25,7 @@ export type DcEventType<T extends EventType["kind"]> = Extract<
2525
>;
2626

2727
export class BaseDeltaChat<
28-
Transport extends BaseTransport<any>
28+
Transport extends BaseTransport<any>,
2929
> extends TinyEmitter<Events> {
3030
rpc: RawClient;
3131
account?: T.Account;
@@ -34,7 +34,10 @@ export class BaseDeltaChat<
3434
//@ts-ignore
3535
private eventTask: Promise<void>;
3636

37-
constructor(public transport: Transport, startEventLoop: boolean) {
37+
constructor(
38+
public transport: Transport,
39+
startEventLoop: boolean,
40+
) {
3841
super();
3942
this.rpc = new RawClient(this.transport);
4043
if (startEventLoop) {
@@ -53,7 +56,7 @@ export class BaseDeltaChat<
5356
this.contextEmitters[event.contextId].emit(
5457
event.event.kind,
5558
//@ts-ignore
56-
event.event as any
59+
event.event as any,
5760
);
5861
this.contextEmitters[event.contextId].emit("ALL", event.event as any);
5962
}
@@ -83,7 +86,10 @@ export class StdioDeltaChat extends BaseDeltaChat<StdioTransport> {
8386
}
8487

8588
export class StdioTransport extends BaseTransport {
86-
constructor(public input: any, public output: any) {
89+
constructor(
90+
public input: any,
91+
public output: any,
92+
) {
8793
super();
8894

8995
var buffer = "";

deltachat-jsonrpc/typescript/test/basic.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ describe("basic tests", () => {
3131

3232
expect(
3333
await Promise.all(
34-
validAddresses.map((email) => dc.rpc.checkEmailValidity(email))
35-
)
34+
validAddresses.map((email) => dc.rpc.checkEmailValidity(email)),
35+
),
3636
).to.not.contain(false);
3737

3838
expect(
3939
await Promise.all(
40-
invalidAddresses.map((email) => dc.rpc.checkEmailValidity(email))
41-
)
40+
invalidAddresses.map((email) => dc.rpc.checkEmailValidity(email)),
41+
),
4242
).to.not.contain(true);
4343
});
4444

@@ -84,7 +84,7 @@ describe("basic tests", () => {
8484
const contactId = await dc.rpc.createContact(
8585
accountId,
8686
"example@delta.chat",
87-
null
87+
null,
8888
);
8989
expect((await dc.rpc.getContact(accountId, contactId)).isBlocked).to.be
9090
.false;
@@ -126,7 +126,7 @@ describe("basic tests", () => {
126126
await dc.rpc.batchSetConfig(accountId, config);
127127
const retrieved = await dc.rpc.batchGetConfig(
128128
accountId,
129-
Object.keys(config)
129+
Object.keys(config),
130130
);
131131
expect(retrieved).to.deep.equal(config);
132132
});
@@ -138,7 +138,7 @@ describe("basic tests", () => {
138138
await dc.rpc.batchSetConfig(accountId, config);
139139
const retrieved = await dc.rpc.batchGetConfig(
140140
accountId,
141-
Object.keys(config)
141+
Object.keys(config),
142142
);
143143
expect(retrieved).to.deep.equal(config);
144144
});
@@ -152,7 +152,7 @@ describe("basic tests", () => {
152152
await dc.rpc.batchSetConfig(accountId, config);
153153
const retrieved = await dc.rpc.batchGetConfig(
154154
accountId,
155-
Object.keys(config)
155+
Object.keys(config),
156156
);
157157
expect(retrieved).to.deep.equal(config);
158158
});

deltachat-jsonrpc/typescript/test/online.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ describe("online tests", function () {
1717
if (process.env.COVERAGE && !process.env.COVERAGE_OFFLINE) {
1818
console.error(
1919
"CAN NOT RUN COVERAGE correctly: Missing CHATMAIL_DOMAIN environment variable!\n\n",
20-
"You can set COVERAGE_OFFLINE=1 to circumvent this check and skip the online tests, but those coverage results will be wrong, because some functions can only be tested in the online test"
20+
"You can set COVERAGE_OFFLINE=1 to circumvent this check and skip the online tests, but those coverage results will be wrong, because some functions can only be tested in the online test",
2121
);
2222
process.exit(1);
2323
}
2424
console.log(
25-
"Missing CHATMAIL_DOMAIN environment variable!, skip integration tests"
25+
"Missing CHATMAIL_DOMAIN environment variable!, skip integration tests",
2626
);
2727
this.skip();
2828
}
@@ -36,15 +36,15 @@ describe("online tests", function () {
3636
account1 = createTempUser(process.env.CHATMAIL_DOMAIN);
3737
if (!account1 || !account1.email || !account1.password) {
3838
console.log(
39-
"We didn't got back an account from the api, skip integration tests"
39+
"We didn't got back an account from the api, skip integration tests",
4040
);
4141
this.skip();
4242
}
4343

4444
account2 = createTempUser(process.env.CHATMAIL_DOMAIN);
4545
if (!account2 || !account2.email || !account2.password) {
4646
console.log(
47-
"We didn't got back an account2 from the api, skip integration tests"
47+
"We didn't got back an account2 from the api, skip integration tests",
4848
);
4949
this.skip();
5050
}
@@ -92,7 +92,7 @@ describe("online tests", function () {
9292
accountId2,
9393
chatIdOnAccountB,
9494
false,
95-
false
95+
false,
9696
);
9797

9898
expect(messageList).have.length(1);
@@ -124,11 +124,11 @@ describe("online tests", function () {
124124
accountId2,
125125
chatIdOnAccountB,
126126
false,
127-
false
127+
false,
128128
);
129129
const message = await dc.rpc.getMessage(
130130
accountId2,
131-
messageList.reverse()[0]
131+
messageList.reverse()[0],
132132
);
133133
expect(message.text).equal("Hello2");
134134
// Send message back from B to A
@@ -150,7 +150,7 @@ describe("online tests", function () {
150150
const info = await dc.rpc.getProviderInfo(acc, "example.com");
151151
expect(info).to.be.not.null;
152152
expect(info?.overviewPage).to.equal(
153-
"https://providers.delta.chat/example-com"
153+
"https://providers.delta.chat/example-com",
154154
);
155155
expect(info?.status).to.equal(3);
156156
});
@@ -167,12 +167,12 @@ async function waitForEvent<T extends DcEvent["kind"]>(
167167
dc: DeltaChat,
168168
eventType: T,
169169
accountId: number,
170-
timeout: number = EVENT_TIMEOUT
170+
timeout: number = EVENT_TIMEOUT,
171171
): Promise<Extract<DcEvent, { kind: T }>> {
172172
return new Promise((resolve, reject) => {
173173
const rejectTimeout = setTimeout(
174174
() => reject(new Error("Timeout reached before event came in")),
175-
timeout
175+
timeout,
176176
);
177177
const callback = (contextId: number, event: DcEvent) => {
178178
if (contextId == accountId) {

deltachat-jsonrpc/typescript/test/test_base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function startServer(): Promise<RpcServerHandle> {
1414
const tmpDir = await mkdtemp(join(tmpdir(), "deltachat-jsonrpc-test"));
1515

1616
const pathToServerBinary = resolve(
17-
join(await getTargetDir(), "debug/deltachat-rpc-server")
17+
join(await getTargetDir(), "debug/deltachat-rpc-server"),
1818
);
1919

2020
const server = spawn(pathToServerBinary, {
@@ -29,7 +29,7 @@ export async function startServer(): Promise<RpcServerHandle> {
2929
throw new Error(
3030
"Failed to start server executable " +
3131
pathToServerBinary +
32-
", make sure you built it first."
32+
", make sure you built it first.",
3333
);
3434
});
3535
let shouldClose = false;
@@ -83,7 +83,7 @@ function getTargetDir(): Promise<string> {
8383
reject(error);
8484
}
8585
}
86-
}
86+
},
8787
);
8888
});
8989
}

0 commit comments

Comments
 (0)