search_awesome/doc_load/load.test.ts

16 lines
699 B
TypeScript
Raw Permalink Normal View History

2022-11-29 17:55:06 +09:00
import { assertEquals } from "std/testing/asserts.ts";
import { fromFileUrl, join } from "std/path/mod.ts";
import { readDoc } from "./load.ts";
Deno.test("readDoc", async () => {
let path = fromFileUrl(import.meta.url)
path = join(path,"../mysample.md");
const doc = await readDoc(path, true);
assertEquals(doc.name, "aws-cdk");
assertEquals(doc.star, 9537);
assertEquals(doc.fork, 2905);
assertEquals(doc.desc, "The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code");
assertEquals(doc.url, "https://github.com/aws/aws-cdk");
assertEquals(doc.tags, ['aws', 'typescript', 'cloud-infrastructure', 'infrastructure-as-code']);
});