Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migration from Python to JavaScript
- Loading branch information
Showing
6 changed files
with
99 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import config from '../lib/config' | ||
import Preferences from '../lib/Preferences' | ||
|
||
const prefs = new Preferences(config.username, config.password) | ||
|
||
beforeAll(async function() { | ||
// because if not set in vacation will not be found later | ||
// we must make sure they are there at the start | ||
await prefs.setOrCreate('autoReplyText', '', ['defaults', 'Vacation']) | ||
await prefs.setOrCreate('PreventInvitations', 0, ['settings', 'Calendar']) | ||
await prefs.setOrCreate('PreventInvitationsWhitelist', {}, ['settings', 'Calendar']) | ||
}) | ||
|
||
describe('preferences', function() { | ||
|
||
const _setTextPref = async function(prefText) { | ||
await prefs.set('autoReplyText', prefText) | ||
const prefData = await prefs.get('Vacation') | ||
|
||
expect(prefData.autoReplyText) | ||
.withContext(`Set a text preference to a known value`) | ||
.toEqual(prefText) | ||
} | ||
|
||
// preferencesTest | ||
|
||
it('Set/get a text preference - normal characters', async function() { | ||
await _setTextPref('defaultText') | ||
}) | ||
|
||
it('Set/get a text preference - weird characters - used to crash on 1.3.12', async function() { | ||
const prefText = `weird data \ ' \"; ^` | ||
await _setTextPref(prefText) | ||
}) | ||
|
||
it('Set/get the PreventInvitation pref', async function() { | ||
await prefs.set('PreventInvitations', 0) | ||
const notset = await prefs.get('Calendar', false) | ||
expect(notset.PreventInvitations) | ||
.withContext(`Set/get Settings/Calendar/PreventInvitations (0)`) | ||
.toEqual(0) | ||
await prefs.set('PreventInvitations', 1) | ||
const isset = await prefs.get('Calendar', false) | ||
expect(isset.PreventInvitations) | ||
.withContext(`Set/get Settings/Calendar/PreventInvitations (1)`) | ||
.toEqual(1) | ||
}) | ||
|
||
it('Set/get the PreventInvitations Whitelist', async function() { | ||
await prefs.set('PreventInvitationsWhitelist', config.white_listed_attendee) | ||
const whitelist = await prefs.get('Calendar', false) | ||
expect(whitelist.PreventInvitationsWhitelist) | ||
.withContext(`Set/get Settings/Calendar/PreventInvitationsWhitelist`) | ||
.toEqual(config.white_listed_attendee) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"spec_dir": "spec", | ||
"spec_files": [ | ||
"**/*[sS]pec.?(m)js" | ||
], | ||
"helpers": [ | ||
"helpers/**/*.?(m)js" | ||
], | ||
"stopSpecOnExpectationFailure": false, | ||
"random": true | ||
} |