chore: init
This commit is contained in:
16
tests/EklaseAuthClient.test.ts
Normal file
16
tests/EklaseAuthClient.test.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { test, expect } from "bun:test";
|
||||
import { APIClient } from "../src/Client";
|
||||
|
||||
test.todo("Authenticated API request", async () => {
|
||||
const client = new APIClient({
|
||||
username: process.env.USERNAME!,
|
||||
password: process.env.PASSWORD!
|
||||
});
|
||||
|
||||
const token = await client.getToken();
|
||||
expect(typeof token.token).toBe("string");
|
||||
console.log(token);
|
||||
|
||||
const user = await client.apiRequest("https://family.e-klase.lv/api/user");
|
||||
console.log(await user.json());
|
||||
});
|
||||
21
tests/NameUtil.test.ts
Normal file
21
tests/NameUtil.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { test, expect } from "bun:test";
|
||||
import { normalizeName } from "../src";
|
||||
|
||||
// LV/EN placeholder names
|
||||
test.each([
|
||||
// https://en.wikipedia.org/wiki/List_of_placeholder_names#Latvian
|
||||
{
|
||||
fn: "Andris",
|
||||
ln: "Paraudziņš"
|
||||
},
|
||||
// https://en.wikipedia.org/wiki/List_of_placeholder_names#English
|
||||
{
|
||||
fn: "John",
|
||||
ln: "Doe"
|
||||
}
|
||||
])("Full government name normalization info FN/LN", (v) => {
|
||||
// why last name first?
|
||||
const x = normalizeName(`${v.ln} ${v.fn}`);
|
||||
expect(x.firstName).toBe(v.fn);
|
||||
expect(x.lastName).toBe(v.ln);
|
||||
});
|
||||
Reference in New Issue
Block a user