Skip to content

Commit

Permalink
📦 Update bun-bagel package
Browse files Browse the repository at this point in the history
  • Loading branch information
DRFR0ST committed May 26, 2024
1 parent c04ff24 commit a3bcc37
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"devDependencies": {
"bun-types": "latest",
"rimraf": "latest",
"bun-bagel": "1.0.5"
"bun-bagel": "^1.0.8"
},
"peerDependencies": {
"typescript": "latest"
Expand Down
15 changes: 13 additions & 2 deletions sandbox/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LibreLinkClient } from "../src";
import { mock, clearMocks } from "bun-bagel";

// Create a new LibreLinkClient instance.
const client = new LibreLinkClient();
Expand Down Expand Up @@ -40,9 +41,9 @@ const main = async () => {
/** =============================
Login example
=================================*/
await login();
// await login();

console.log(client.me);
// console.log(client.me);

/** =============================
Fetch connections example
Expand Down Expand Up @@ -83,6 +84,16 @@ const main = async () => {
// console.log(value, " - ", timestamp.toTimeString());
// console.log(`Trend ${trendType}`);
// }


// Register the mock for the example URL.
mock("https://example.com/api/users/*", { data: { name: "Foo" } });

// Make a fetch request to the mocked URL
const response = await fetch("https://example.com/api/users/123", { method: "POST" });

// Print the response body
console.log(await response.json());
};

main();
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export class LibreLinkClient {
const error = err as Error;

console.error(error);
throw new Error(`Error fetching connections from Libre Link Up API. ${error.message}`);
throw new Error(`Error processing request to Libre Link Up API. ${error.message}`);
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe('LibreLinkClient', () => {

test('should successfully login', async () => {
// Mock the fetch method
mock('llu/auth/login', { data: { data: LibreLinkLoginMock } });

mock('llu/auth/login', { data: { data: LibreLinkLoginMock }, method: "POST" });
await client.login();

expect(client.me).toBeTruthy();
Expand Down

0 comments on commit a3bcc37

Please sign in to comment.