Add notepad
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user