Remove unused method

This commit is contained in:
proteriax 2021-07-08 02:09:20 -04:00
parent 0230f32aab
commit c93250f8e8
2 changed files with 16 additions and 17 deletions

View File

@ -72,7 +72,10 @@ export class Vault {
}
},
values: () => Array.from(this.#overviews.values()),
values: () => {
this.#assertUnlocked()
return Array.from(this.#overviews.values())
},
})
/**
@ -127,21 +130,6 @@ export class Vault {
}
}
getOverview(title: string): Overview
getOverview(predicate: (overview: Overview) => boolean): Overview
getOverview(condition: string | ((overview: Overview) => boolean)) {
if (typeof condition === "string") {
const title = condition
condition = overview => overview.title === title
}
for (const value of this.#overviews.values()) {
if (condition(value)) {
return value
}
}
}
getItem(uuid: string) {
this.#assertUnlocked()
const encrypted = uuid ? this.#bands.get(uuid[0])![uuid] : undefined

View File

@ -38,5 +38,16 @@ describe("OnePassword", () => {
});
});
describe("lock", () => {});
describe("lock", () => {
it("locks", async () => {
const instance = new OnePassword({ path: freddy });
const vault = await instance.getProfile("default");
vault.unlock("freddy");
expect(vault.isLocked).to.be.false;
vault.lock();
expect(vault.isLocked).to.be.true;
expect(() => vault.overviews.values()).to.throw();
});
});
});