Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
feat(apis): Pipedrive tests base
Browse files Browse the repository at this point in the history
  • Loading branch information
kbastamow committed Aug 8, 2023
1 parent d0bcda0 commit c1e6504
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions lib/apis/pipedrive/mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,30 @@ Deno.test("pipedrive", async (t) => {
});

await t.step("search deals", async () => {
const result = await api.deals.search.get({ term: "" }); //What term do we want?
const result = await api.deals.search.get({ term: "" });
assertExists(result.data.items);
assertEquals(Array.isArray(result.data.items), true);
});

await t.step("add deal", async () => {
const result = await api.deals.post({ title: "Test Deal", value: 100 }); //Are we dealing with real DB?
const result = await api.deals.post({
title: "Test Deal",
});
assertExists(result.data);
assertEquals(typeof result.data, "object");
});

// await t.step("update deal", async () => {
// const result = await api.deals[DEAL_ID].put({ title: "Updated Title" }) //We don't have deal id
// assertExists(result.data)
// assertEquals(typeof result.data, "object")
// });
await t.step("update deal", async () => {
const result = await api.deals["DEAL_ID"].put({ title: "Updated Title" });
assertExists(result.data);
assertEquals(typeof result.data, "object");
});

// await t.step("delete deal", async () => {
// const result = api.deals[DEAL_ID].delete() //We don't have deal id
// assertExists(result.data)
// assertEquals(typeof result.data, "object")
// });
await t.step("delete deal", async () => {
const result = await api.deals["DEAL_ID"].delete();
assertExists(result.data);
assertEquals(typeof result.data, "object");
});

await t.step("find persons", async () => {
const result = await api.persons.get();
Expand All @@ -44,7 +46,7 @@ Deno.test("pipedrive", async (t) => {
});

await t.step("search persons", async () => {
const result = await api.persons.search.get({ term: "" }); //TERM?
const result = await api.persons.search.get({ term: "" });
assertExists(result.data.items);
assertEquals(Array.isArray(result.data.items), true);
});
Expand All @@ -55,15 +57,15 @@ Deno.test("pipedrive", async (t) => {
assertEquals(typeof result.data, "object");
});

// await t.step("update person", async () => {
// const result = await api.persons[PERSON_ID].put({ name: "Jane Doe" })
// assertExists(result.data)
// assertEquals(typeof result.data, "object")
// });
await t.step("update person", async () => {
const result = await api.persons["PERSON_ID"].put({ name: "Jane Doe" });
assertExists(result.data);
assertEquals(typeof result.data, "object");
});

// await t.step("delete person", async () => {
// const result = await api.persons[PERSON_ID].delete()
// assertExists(result.data)
// assertEquals(typeof result.data, "object")
// });
await t.step("delete person", async () => {
const result = await api.persons["PERSON_ID"].delete();
assertExists(result.data);
assertEquals(typeof result.data, "object");
});
});

0 comments on commit c1e6504

Please sign in to comment.