From bcb819d0091557f2e64f2271b9ae15c7a7bce792 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 29 Jul 2022 13:02:41 +1000 Subject: adding a test for prefs default --- test/spec/LibreJSSpec.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js index 5632e9f..501efa7 100644 --- a/test/spec/LibreJSSpec.js +++ b/test/spec/LibreJSSpec.js @@ -303,7 +303,7 @@ describe('LibreJS\' components', () => { setTimeout(async () => { const [frameBody] = await browser.tabs.executeScript(tab.id, { code: 'document.getElementById("_LibreJS_frame").contentWindow.document.body.innerHTML' - }) + }); expect(frameBody).not.toContain('About Us'); expect(frameBody).toContain('Contact Us'); expect(frameBody).toContain('Website Feedback'); @@ -313,6 +313,19 @@ describe('LibreJS\' components', () => { }); }); + describe('The prefs', () => { + it('should have the defaults', async () => { + const defaults = await browser.storage.local.get(['pref_subject', 'pref_body']); + expect(defaults).toEqual({ + pref_subject: 'Issues with Javascript on your website', + pref_body: `Please consider using a free license for the Javascript on your website. + +[Message generated by LibreJS. See https://www.gnu.org/software/librejs/ for more information] +` + }); + }); + }); + afterAll(async () => { await browser.tabs.remove(tab.id); browser.tabs.update((await browser.tabs.getCurrent()).id, { active: true }); -- cgit v1.2.3