Compare commits

...

3 commits

Author SHA1 Message Date
naskya cc560811cf
test (backend-rs): remove ava in favor of cargo test 2024-04-27 11:23:16 +09:00
naskya 28b9e35f2a
style: use yes/no instead of ok/cancel 2024-04-27 11:01:25 +09:00
naskya 51f9d20073
fix (client): don't interpret sample account ID as MFM 2024-04-27 10:58:17 +09:00
6 changed files with 25 additions and 620 deletions

View file

@ -1,12 +0,0 @@
target
Cargo.lock
.cargo
.github
npm
.eslintrc
rustfmt.toml
yarn.lock
*.node
.yarn
__test__
renovate.json

View file

@ -1,32 +0,0 @@
import test from "ava";
import {
convertId,
IdConvertType,
nativeInitIdGenerator,
nativeCreateId,
nativeRandomStr,
} from "../built/index.js";
test("convert to mastodon id", (t) => {
t.is(convertId("9gf61ehcxv", IdConvertType.MastodonId), "960365976481219");
t.is(
convertId("9fbr9z0wbrjqyd3u", IdConvertType.MastodonId),
"2083785058661759970208986",
);
t.is(
convertId("9fbs680oyviiqrol9md73p8g", IdConvertType.MastodonId),
"5878598648988104013828532260828151168",
);
});
test("create cuid2 with timestamp prefix", (t) => {
nativeInitIdGenerator(16, "");
t.not(nativeCreateId(Date.now()), nativeCreateId(Date.now()));
t.is(nativeCreateId(Date.now()).length, 16);
});
test("create random string", (t) => {
t.not(nativeRandomStr(16), nativeRandomStr(16));
t.is(nativeRandomStr(24).length, 24);
});

View file

@ -22,11 +22,7 @@
}
},
"devDependencies": {
"@napi-rs/cli": "2.18.1",
"ava": "6.1.2"
},
"ava": {
"timeout": "3m"
"@napi-rs/cli": "2.18.1"
},
"engines": {
"node": ">= 10"
@ -36,11 +32,7 @@
"build": "napi build --features napi --no-const-enum --platform --release ./built/",
"build:debug": "napi build --features napi --no-const-enum --platform ./built/",
"prepublishOnly": "napi prepublish -t npm",
"test": "pnpm run cargo:test && pnpm run build:debug && ava",
"universal": "napi universal",
"version": "napi version",
"cargo:test": "pnpm run cargo:unit && pnpm run cargo:integration",
"cargo:unit": "cargo test unit_test && cargo test -F napi unit_test",
"cargo:integration": "cargo test int_test"
"version": "napi version"
}
}

View file

@ -379,6 +379,7 @@ export function inputText(props: {
default?: string | null;
minLength?: number;
maxLength?: number;
isPlaintext?: boolean;
}): Promise<
| { canceled: true; result?: undefined }
| {
@ -400,6 +401,7 @@ export function inputText(props: {
minLength: props.minLength,
maxLength: props.maxLength,
},
isPlaintext: props.isPlaintext,
},
{
done: (result) => {

View file

@ -20,6 +20,8 @@ if (isSignedIn(me)) {
const { canceled } = await os.confirm({
type: "question",
text: i18n.ts.useThisAccountConfirm,
okText: i18n.ts.yes,
cancelText: i18n.ts.no,
});
// use the current account
@ -32,6 +34,7 @@ if (isSignedIn(me)) {
// Otherwise ask the user what the other account ID is
const remoteAccountId = await os.inputText({
text: i18n.ts.inputAccountId,
isPlaintext: true,
});
// If the user do not want enter uri, the user will be redirected to the user page.

File diff suppressed because it is too large Load diff