From 7b887b047d662793ec6bdaaaa799c60cc38b07b3 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 10 Nov 2018 20:57:43 +0100 Subject: [PATCH] Update tests --- types/kdbxweb/kdbxweb-tests.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/types/kdbxweb/kdbxweb-tests.ts b/types/kdbxweb/kdbxweb-tests.ts index d667117b6b..dfc8167b4b 100644 --- a/types/kdbxweb/kdbxweb-tests.ts +++ b/types/kdbxweb/kdbxweb-tests.ts @@ -8,11 +8,27 @@ const credentials = new kdbxweb.Credentials( ); kdbxweb.Kdbx.load(dataarr, credentials).then(db => db); -kdbxweb.Kdbx.loadXml("data", credentials).then(db => db); +kdbxweb.Kdbx.loadXml("data", credentials).then(db => db); -const newDb = kdbxweb.Kdbx.create(credentials, 'My new db'); -const group = newDb.createGroup(newDb.getDefaultGroup(), 'subgroup'); +const newDb = kdbxweb.Kdbx.create(credentials, "My new db"); +const defaultGroup = newDb.getDefaultGroup(); +const group = newDb.createGroup(defaultGroup, "subgroup"); +const anotherGroup = newDb.createGroup(group, "subgroup-2"); +const yetAnotherGroup = newDb.createGroup(group, "subgroup-3"); +const deepGroup = defaultGroup.groups[0].groups[0]; + +if (newDb.getGroup(yetAnotherGroup.uuid)){ + newDb.remove(yetAnotherGroup); +} const entry = newDb.createEntry(group); +newDb.move(entry, anotherGroup); +newDb.remove(entry); newDb.save().then(dataAsArrayBuffer => dataAsArrayBuffer); newDb.saveXml().then(xmlAsString => xmlAsString); + +newDb.cleanup({ + customIcons: true +}); + +newDb.upgrade();