Add notepad

This commit is contained in:
proteriax
2021-10-26 20:48:58 -04:00
parent 7c12f499f2
commit 26f8485761
14 changed files with 2590 additions and 934 deletions

View File

@ -26,24 +26,40 @@ describe("OnePassword", () => {
vault = await new OnePassword({ path: freddy }).getProfile("default");
});
it("accepts correct password", () => {
expect(() => vault.unlock("freddy")).to.not.throw();
it("accepts correct password", async () => {
await expect(vault.unlock("freddy")).to.be.fulfilled;
expect(vault.isLocked).to.be.false;
});
it("rejects wrong password", () => {
["Freddy", "_freddy", ""].forEach((password) => {
expect(() => vault.unlock(password)).to.throw("Invalid password");
["Freddy", "_freddy", ""].forEach(async (password) => {
await expect(vault.unlock(password)).to.be.rejectedWith(
"Invalid password"
);
expect(vault.isLocked).to.be.true;
});
});
});
describe("content", () => {
let vault: Vault;
beforeEach(async () => {
vault = await new OnePassword({ path: freddy }).getProfile("default");
await vault.unlock("freddy");
});
it("reads overviews", () => {
const overviews = vault.overviews.values();
expect(overviews).to.have.lengthOf(29);
});
});
describe("lock", () => {
it("locks", async () => {
const instance = new OnePassword({ path: freddy });
const vault = await instance.getProfile("default");
vault.unlock("freddy");
await vault.unlock("freddy");
expect(vault.isLocked).to.be.false;
vault.lock();