updated tests to match new formatting"

This commit is contained in:
Kendall Werts 2020-01-22 23:50:19 -06:00
parent 3aa2902cde
commit 61b5c2e4b2

View file

@ -93,8 +93,7 @@ browser.tests = {
); );
// add 200ok (bad data). // add 200ok (bad data).
await browser.storage.sync.set({ const testSites = {
"assignedSites": {
"siteContainerMap@@_developer.mozilla.org": { "siteContainerMap@@_developer.mozilla.org": {
"userContextId": "588", "userContextId": "588",
"neverAsk": true, "neverAsk": true,
@ -131,13 +130,16 @@ browser.tests = {
"identityMacAddonUUID": "b5f5f794-b37e-4cec-9f4e-6490df620336", "identityMacAddonUUID": "b5f5f794-b37e-4cec-9f4e-6490df620336",
"hostname": "www.linkedin.com" "hostname": "www.linkedin.com"
} }
};
for (const site of Object.keys(testSites)) {
await browser.storage.sync.set({[site]:testSites[site]});
} }
});
await browser.storage.sync.set({ await browser.storage.sync.set({
deletedSiteList: ["siteContainerMap@@_www.google.com"] deletedSiteList: ["siteContainerMap@@_www.google.com"]
}); });
console.log(await browser.storage.sync.get());
await sync.runSync(); await sync.runSync();
const assignedSites = await assignManager.storageArea.getAssignedSites(); const assignedSites = await assignManager.storageArea.getAssignedSites();
@ -153,16 +155,10 @@ browser.tests = {
await sync.runSync(); await sync.runSync();
const getSync = await browser.storage.sync.get();
const getAssignedSites = const getAssignedSites =
await assignManager.storageArea.getAssignedSites(); await assignManager.storageArea.getAssignedSites();
const identities = await browser.contextualIdentities.query({}); const identities = await browser.contextualIdentities.query({});
console.assert(
Object.keys(getSync.cookieStoreIDmap).length === 5,
"cookieStoreIDmap should have 5 entries"
);
console.assert( console.assert(
identities.length === 5, identities.length === 5,
"There should be 5 identities" "There should be 5 identities"
@ -183,17 +179,11 @@ browser.tests = {
await sync.runSync(); await sync.runSync();
const getSync = await browser.storage.sync.get();
const getAssignedSites = const getAssignedSites =
await assignManager.storageArea.getAssignedSites(); await assignManager.storageArea.getAssignedSites();
const identities = await browser.contextualIdentities.query({}); const identities = await browser.contextualIdentities.query({});
console.assert(
Object.keys(getSync.cookieStoreIDmap).length === 6,
"cookieStoreIDmap should have 6 entries"
);
console.assert( console.assert(
identities.length === 6, identities.length === 6,
"There should be 6 identities" "There should be 6 identities"
@ -219,17 +209,11 @@ browser.tests = {
await sync.runSync(); await sync.runSync();
const getSync = await browser.storage.sync.get();
const getAssignedSites = const getAssignedSites =
await assignManager.storageArea.getAssignedSites(); await assignManager.storageArea.getAssignedSites();
const identities = await browser.contextualIdentities.query({}); const identities = await browser.contextualIdentities.query({});
console.assert(
Object.keys(getSync.cookieStoreIDmap).length === 7,
"cookieStoreIDmap should have 7 entries"
);
console.assert( console.assert(
identities.length === 7, identities.length === 7,
"There should be 7 identities" "There should be 7 identities"
@ -419,118 +403,86 @@ const LOCAL_DATA = {
}; };
const SYNC_DATA = { const SYNC_DATA = {
"identities": [ "identity@@_22ded543-5173-44a5-a47a-8813535945ca": {
{
"name": "Personal", "name": "Personal",
"icon": "fingerprint", "icon": "fingerprint",
"iconUrl": "resource://usercontext-content/fingerprint.svg",
"color": "red", "color": "red",
"colorCode": "#37adff", "cookieStoreId": "firefox-container-146",
"cookieStoreId": "firefox-container-146" "macAddonUUID": "22ded543-5173-44a5-a47a-8813535945ca"
}, },
{ "identity@@_63e5212f-0858-418e-b5a3-09c2dea61fcd": {
"name": "Oscar", "name": "Oscar",
"icon": "dollar", "icon": "dollar",
"iconUrl": "resource://usercontext-content/dollar.svg",
"color": "green", "color": "green",
"colorCode": "#51cd00", "cookieStoreId": "firefox-container-147",
"cookieStoreId": "firefox-container-147" "macAddonUUID": "3e5212f-0858-418e-b5a3-09c2dea61fcd"
}, },
{ "identity@@_71335417-158e-4d74-a55b-e9e9081601ec": {
"name": "Mozilla", "name": "Mozilla",
"icon": "pet", "icon": "pet",
"iconUrl": "resource://usercontext-content/briefcase.svg",
"color": "red", "color": "red",
"colorCode": "#ff613d", "cookieStoreId": "firefox-container-148",
"cookieStoreId": "firefox-container-148" "macAddonUUID": "71335417-158e-4d74-a55b-e9e9081601ec"
}, },
{ "identity@@_59c4e5f7-fe3b-435a-ae60-1340db31a91b": {
"name": "Groceries, obviously", "name": "Groceries, obviously",
"icon": "cart", "icon": "cart",
"iconUrl": "resource://usercontext-content/cart.svg",
"color": "pink", "color": "pink",
"colorCode": "#ffcb00", "cookieStoreId": "firefox-container-149",
"cookieStoreId": "firefox-container-149" "macAddonUUID": "59c4e5f7-fe3b-435a-ae60-1340db31a91b"
}, },
{ "identity@@_3dc916fb-8c0a-4538-9758-73ef819a45f7": {
"name": "Facebook", "name": "Facebook",
"icon": "fence", "icon": "fence",
"iconUrl": "resource://usercontext-content/fence.svg",
"color": "toolbar", "color": "toolbar",
"colorCode": "#7c7c7d", "cookieStoreId": "firefox-container-150",
"cookieStoreId": "firefox-container-150" "macAddonUUID": "3dc916fb-8c0a-4538-9758-73ef819a45f7"
} }
],
"cookieStoreIDmap": {
"firefox-container-146": "22ded543-5173-44a5-a47a-8813535945ca",
"firefox-container-147": "63e5212f-0858-418e-b5a3-09c2dea61fcd",
"firefox-container-148": "71335417-158e-4d74-a55b-e9e9081601ec",
"firefox-container-149": "59c4e5f7-fe3b-435a-ae60-1340db31a91b",
"firefox-container-150": "3dc916fb-8c0a-4538-9758-73ef819a45f7"
},
"assignedSites": {}
}; };
const DUPE_TEST_SYNC = { const DUPE_TEST_SYNC = {
"identities": [ "identity@@_d20d7af2-9866-468e-bb43-541efe8c2c2e": {
{
"name": "Personal", "name": "Personal",
"icon": "fingerprint", "icon": "fingerprint",
"iconUrl": "resource://usercontext-content/fingerprint.svg",
"color": "red", "color": "red",
"colorCode": "#ff613d", "cookieStoreId": "firefox-container-588",
"cookieStoreId": "firefox-container-588" "macAddonUUID": "d20d7af2-9866-468e-bb43-541efe8c2c2e"
}, },
{ "identity@@_cdd73c20-c26a-4c06-9b17-735c1f5e9187": {
"name": "Banking", "name": "Big Bird",
"icon": "dollar", "icon": "pet",
"iconUrl": "resource://usercontext-content/dollar.svg", "color": "yellow",
"color": "green", "cookieStoreId": "firefox-container-589",
"colorCode": "#51cd00", "macAddonUUID": "cdd73c20-c26a-4c06-9b17-735c1f5e9187"
"cookieStoreId": "firefox-container-589"
}, },
{ "identity@@_32cc4a9b-05ed-4e54-8e11-732468de62f4": {
"name": "Mozilla", "name": "Mozilla",
"icon": "pet", "icon": "pet",
"iconUrl": "resource://usercontext-content/pet.svg",
"color": "red", "color": "red",
"colorCode": "#ff613d", "cookieStoreId": "firefox-container-590",
"cookieStoreId": "firefox-container-590" "macAddonUUID": "32cc4a9b-05ed-4e54-8e11-732468de62f4"
}, },
{ "identity@@_9ff381e3-4c11-420d-8e12-e352a3318be1": {
"name": "Groceries, obviously", "name": "Groceries, obviously",
"icon": "cart", "icon": "cart",
"iconUrl": "resource://usercontext-content/cart.svg",
"color": "pink", "color": "pink",
"colorCode": "#ff4bda", "cookieStoreId": "firefox-container-591",
"cookieStoreId": "firefox-container-591" "macAddonUUID": "9ff381e3-4c11-420d-8e12-e352a3318be1"
}, },
{ "identity@@_3dc916fb-8c0a-4538-9758-73ef819a45f7": {
"name": "Facebook", "name": "Facebook",
"icon": "fence", "icon": "fence",
"iconUrl": "resource://usercontext-content/fence.svg",
"color": "toolbar", "color": "toolbar",
"colorCode": "#7c7c7d", "cookieStoreId": "firefox-container-592",
"cookieStoreId": "firefox-container-592" "macAddonUUID": "3dc916fb-8c0a-4538-9758-73ef819a45f7"
}, },
{ "identity@@_63e5212f-0858-418e-b5a3-09c2dea61fcd": {
"name": "Oscar", "name": "Oscar",
"icon": "dollar", "icon": "dollar",
"iconUrl": "resource://usercontext-content/dollar.svg",
"color": "green", "color": "green",
"colorCode": "#51cd00", "cookieStoreId": "firefox-container-593",
"cookieStoreId": "firefox-container-593" "macAddonUUID": "63e5212f-0858-418e-b5a3-09c2dea61fcd"
}
],
"cookieStoreIDmap": {
"firefox-container-588": "d20d7af2-9866-468e-bb43-541efe8c2c2e",
"firefox-container-589": "cdd73c20-c26a-4c06-9b17-735c1f5e9187",
"firefox-container-590": "32cc4a9b-05ed-4e54-8e11-732468de62f4",
"firefox-container-591": "9ff381e3-4c11-420d-8e12-e352a3318be1",
"firefox-container-592": "3dc916fb-8c0a-4538-9758-73ef819a45f7",
"firefox-container-593": "63e5212f-0858-418e-b5a3-09c2dea61fcd"
}, },
"assignedSites": {
"siteContainerMap@@_developer.mozilla.org": { "siteContainerMap@@_developer.mozilla.org": {
"userContextId": "588", "userContextId": "588",
"neverAsk": true, "neverAsk": true,
@ -561,7 +513,6 @@ const DUPE_TEST_SYNC = {
"identityMacAddonUUID": "9ff381e3-4c11-420d-8e12-e352a3318be1", "identityMacAddonUUID": "9ff381e3-4c11-420d-8e12-e352a3318be1",
"hostname": "www.linkedin.com" "hostname": "www.linkedin.com"
} }
}
}; };
const DUPE_TEST_LOCAL = { const DUPE_TEST_LOCAL = {