forgejo-notifications-core/src/api.test.ts

12 lines
373 B
TypeScript
Raw Normal View History

2023-09-18 17:56:40 +05:30
import Forgejo from "./api";
import authtoken from "../secrets/user1-accesstoken.json";
test("use authentication without setting it ", () => {
const api = new Forgejo("http://localhost:3000", "owner_user");
const token = authtoken["sha1"]
expect(() => api.getTokenAuth()).toThrow();
api.setTokenAuth(token)
expect(api.getTokenAuth().getToken()).toBe(token)
});