mirror of
https://github.com/chatmail/core.git
synced 2026-05-06 16:36:59 +03:00
deltachat-jsonrpc: fix "prettier" arguments
**.ts finds .ts files only in the current directory and no *.js files.
This commit is contained in:
@@ -68,10 +68,7 @@ async function run() {
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
for (const [chatId, _messageId] of chats) {
|
for (const [chatId, _messageId] of chats) {
|
||||||
const chat = await client.rpc.getFullChatById(
|
const chat = await client.rpc.getFullChatById(selectedAccount, chatId);
|
||||||
selectedAccount,
|
|
||||||
chatId
|
|
||||||
);
|
|
||||||
write($main, `<h3>${chat.name}</h3>`);
|
write($main, `<h3>${chat.name}</h3>`);
|
||||||
const messageIds = await client.rpc.getMessageIds(
|
const messageIds = await client.rpc.getMessageIds(
|
||||||
selectedAccount,
|
selectedAccount,
|
||||||
|
|||||||
@@ -3,24 +3,27 @@ import { DeltaChat } from "../dist/deltachat.js";
|
|||||||
run().catch(console.error);
|
run().catch(console.error);
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const delta = new DeltaChat('ws://localhost:20808/ws');
|
const delta = new DeltaChat("ws://localhost:20808/ws");
|
||||||
delta.on("event", (event) => {
|
delta.on("event", (event) => {
|
||||||
console.log("event", event.data);
|
console.log("event", event.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
const email = process.argv[2]
|
const email = process.argv[2];
|
||||||
const password = process.argv[3]
|
const password = process.argv[3];
|
||||||
if (!email || !password) throw new Error('USAGE: node node-add-account.js <EMAILADDRESS> <PASSWORD>')
|
if (!email || !password)
|
||||||
console.log(`creating acccount for ${email}`)
|
throw new Error(
|
||||||
const id = await delta.rpc.addAccount()
|
"USAGE: node node-add-account.js <EMAILADDRESS> <PASSWORD>"
|
||||||
console.log(`created account id ${id}`)
|
);
|
||||||
|
console.log(`creating acccount for ${email}`);
|
||||||
|
const id = await delta.rpc.addAccount();
|
||||||
|
console.log(`created account id ${id}`);
|
||||||
await delta.rpc.setConfig(id, "addr", email);
|
await delta.rpc.setConfig(id, "addr", email);
|
||||||
await delta.rpc.setConfig(id, "mail_pw", password);
|
await delta.rpc.setConfig(id, "mail_pw", password);
|
||||||
console.log('configuration updated')
|
console.log("configuration updated");
|
||||||
await delta.rpc.configure(id)
|
await delta.rpc.configure(id);
|
||||||
console.log('account configured!')
|
console.log("account configured!");
|
||||||
|
|
||||||
const accounts = await delta.rpc.getAllAccounts();
|
const accounts = await delta.rpc.getAllAccounts();
|
||||||
console.log("accounts", accounts);
|
console.log("accounts", accounts);
|
||||||
console.log("waiting for events...")
|
console.log("waiting for events...");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ async function run() {
|
|||||||
|
|
||||||
const accounts = await delta.rpc.getAllAccounts();
|
const accounts = await delta.rpc.getAllAccounts();
|
||||||
console.log("accounts", accounts);
|
console.log("accounts", accounts);
|
||||||
console.log("waiting for events...")
|
console.log("waiting for events...");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
"example:start": "http-server .",
|
"example:start": "http-server .",
|
||||||
"extract-constants": "node ./scripts/generate-constants.js",
|
"extract-constants": "node ./scripts/generate-constants.js",
|
||||||
"generate-bindings": "cargo test",
|
"generate-bindings": "cargo test",
|
||||||
"prettier:check": "prettier --check **.ts",
|
"prettier:check": "prettier --check .",
|
||||||
"prettier:fix": "prettier --write **.ts",
|
"prettier:fix": "prettier --write .",
|
||||||
"test": "run-s test:prepare test:run-coverage test:report-coverage",
|
"test": "run-s test:prepare test:run-coverage test:report-coverage",
|
||||||
"test:prepare": "cargo build --package deltachat-rpc-server --bin deltachat-rpc-server",
|
"test:prepare": "cargo build --package deltachat-rpc-server --bin deltachat-rpc-server",
|
||||||
"test:report-coverage": "node report_api_coverage.mjs",
|
"test:report-coverage": "node report_api_coverage.mjs",
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import chaiAsPromised from "chai-as-promised";
|
|||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
import { StdioDeltaChat as DeltaChat } from "../deltachat.js";
|
import { StdioDeltaChat as DeltaChat } from "../deltachat.js";
|
||||||
|
|
||||||
import {
|
import { RpcServerHandle, startServer } from "./test_base.js";
|
||||||
RpcServerHandle,
|
|
||||||
startServer,
|
|
||||||
} from "./test_base.js";
|
|
||||||
|
|
||||||
describe("basic tests", () => {
|
describe("basic tests", () => {
|
||||||
let serverHandle: RpcServerHandle;
|
let serverHandle: RpcServerHandle;
|
||||||
@@ -15,7 +12,7 @@ describe("basic tests", () => {
|
|||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
serverHandle = await startServer();
|
serverHandle = await startServer();
|
||||||
dc = new DeltaChat(serverHandle.stdin, serverHandle.stdout)
|
dc = new DeltaChat(serverHandle.stdin, serverHandle.stdout);
|
||||||
// dc.on("ALL", (event) => {
|
// dc.on("ALL", (event) => {
|
||||||
//console.log("event", event);
|
//console.log("event", event);
|
||||||
// });
|
// });
|
||||||
@@ -111,8 +108,8 @@ describe("basic tests", () => {
|
|||||||
assert((await dc.rpc.getConfig(accountId, "addr")) == "valid@email");
|
assert((await dc.rpc.getConfig(accountId, "addr")) == "valid@email");
|
||||||
});
|
});
|
||||||
it("set invalid key should throw", async function () {
|
it("set invalid key should throw", async function () {
|
||||||
await expect(dc.rpc.setConfig(accountId, "invalid_key", "some value")).to.be
|
await expect(dc.rpc.setConfig(accountId, "invalid_key", "some value")).to
|
||||||
.eventually.rejected;
|
.be.eventually.rejected;
|
||||||
});
|
});
|
||||||
it("get invalid key should throw", async function () {
|
it("get invalid key should throw", async function () {
|
||||||
await expect(dc.rpc.getConfig(accountId, "invalid_key")).to.be.eventually
|
await expect(dc.rpc.getConfig(accountId, "invalid_key")).to.be.eventually
|
||||||
@@ -125,7 +122,10 @@ describe("basic tests", () => {
|
|||||||
it("set and retrive (batch)", async function () {
|
it("set and retrive (batch)", async function () {
|
||||||
const config = { addr: "valid@email", mail_pw: "1234" };
|
const config = { addr: "valid@email", mail_pw: "1234" };
|
||||||
await dc.rpc.batchSetConfig(accountId, config);
|
await dc.rpc.batchSetConfig(accountId, config);
|
||||||
const retrieved = await dc.rpc.batchGetConfig(accountId, Object.keys(config));
|
const retrieved = await dc.rpc.batchGetConfig(
|
||||||
|
accountId,
|
||||||
|
Object.keys(config)
|
||||||
|
);
|
||||||
expect(retrieved).to.deep.equal(config);
|
expect(retrieved).to.deep.equal(config);
|
||||||
});
|
});
|
||||||
it("set and retrive ui.* (batch)", async function () {
|
it("set and retrive ui.* (batch)", async function () {
|
||||||
@@ -134,7 +134,10 @@ describe("basic tests", () => {
|
|||||||
"ui.enter_key_sends": "true",
|
"ui.enter_key_sends": "true",
|
||||||
};
|
};
|
||||||
await dc.rpc.batchSetConfig(accountId, config);
|
await dc.rpc.batchSetConfig(accountId, config);
|
||||||
const retrieved = await dc.rpc.batchGetConfig(accountId, Object.keys(config));
|
const retrieved = await dc.rpc.batchGetConfig(
|
||||||
|
accountId,
|
||||||
|
Object.keys(config)
|
||||||
|
);
|
||||||
expect(retrieved).to.deep.equal(config);
|
expect(retrieved).to.deep.equal(config);
|
||||||
});
|
});
|
||||||
it("set and retrive mixed(ui and core) (batch)", async function () {
|
it("set and retrive mixed(ui and core) (batch)", async function () {
|
||||||
@@ -145,7 +148,10 @@ describe("basic tests", () => {
|
|||||||
mail_pw: "123456",
|
mail_pw: "123456",
|
||||||
};
|
};
|
||||||
await dc.rpc.batchSetConfig(accountId, config);
|
await dc.rpc.batchSetConfig(accountId, config);
|
||||||
const retrieved = await dc.rpc.batchGetConfig(accountId, Object.keys(config));
|
const retrieved = await dc.rpc.batchGetConfig(
|
||||||
|
accountId,
|
||||||
|
Object.keys(config)
|
||||||
|
);
|
||||||
expect(retrieved).to.deep.equal(config);
|
expect(retrieved).to.deep.equal(config);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export async function createTempUser(url: string) {
|
|||||||
"cache-control": "no-cache",
|
"cache-control": "no-cache",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!response.ok) throw new Error('Received invalid response')
|
if (!response.ok) throw new Error("Received invalid response");
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,4 +89,3 @@ function getTargetDir(): Promise<string> {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user