Initial import of streamline
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import IdeaUploadDialog from "../src/components/IdeaUploadDialog";
|
||||
import { EDDY_SHARE_ACCEPT, eddyShareBaseName, isEddyShareName } from "../src/lib/eddyShare";
|
||||
|
||||
test("上传 Eddy 想法的第一步:文件框收 .eddy,文案不再只说 zip", () => {
|
||||
const html = renderToStaticMarkup(<IdeaUploadDialog myEmail="someone@example.com" onClose={() => {}} onDone={() => {}} />);
|
||||
expect(html).toContain(`accept="${EDDY_SHARE_ACCEPT}"`);
|
||||
expect(EDDY_SHARE_ACCEPT).toContain(".eddy");
|
||||
expect(html).toContain("或点击选择 .eddy / .eddy.zip 文件");
|
||||
expect(html).toContain("存下来的 .eddy 文件");
|
||||
expect(html).not.toContain("选择 .zip 文件");
|
||||
expect(html).not.toContain("导出 zip");
|
||||
});
|
||||
|
||||
test("弹窗用的文件名判断就是 shared 里那一份", () => {
|
||||
expect(isEddyShareName("首页换个标题.eddy")).toBe(true);
|
||||
expect(isEddyShareName("首页换个标题.eddy.zip")).toBe(true);
|
||||
expect(isEddyShareName("截图.png")).toBe(false);
|
||||
expect(eddyShareBaseName("首页换个标题.eddy")).toBe("首页换个标题");
|
||||
});
|
||||
Reference in New Issue
Block a user