Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit fc705e77 authored by Georg Ehrke's avatar Georg Ehrke Committed by GitHub
Browse files

Merge pull request #1618 from nextcloud/tests/defaults

Add unit tests for default alarms and default categories
parents c39772e5 04b86beb
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -19,25 +19,25 @@
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
import { translate } from '@nextcloud/l10n'
import { translate as t } from '@nextcloud/l10n'

export default () => {
	// This list was taken from https://tools.ietf.org/html/rfc5545#section-5
	return [
		translate('calendar', 'Anniversary'),
		translate('calendar', 'Appointment'),
		translate('calendar', 'Business'),
		translate('calendar', 'Education'),
		translate('calendar', 'Holiday'),
		translate('calendar', 'Meeting'),
		translate('calendar', 'Miscellaneous'),
		translate('calendar', 'Non-working hours'),
		translate('calendar', 'Not in office'),
		translate('calendar', 'Personal'),
		translate('calendar', 'Phone call'),
		translate('calendar', 'Sick day'),
		translate('calendar', 'Special occasion'),
		translate('calendar', 'Travel'),
		translate('calendar', 'Vacation'),
		t('calendar', 'Anniversary'),
		t('calendar', 'Appointment'),
		t('calendar', 'Business'),
		t('calendar', 'Education'),
		t('calendar', 'Holiday'),
		t('calendar', 'Meeting'),
		t('calendar', 'Miscellaneous'),
		t('calendar', 'Non-working hours'),
		t('calendar', 'Not in office'),
		t('calendar', 'Personal'),
		t('calendar', 'Phone call'),
		t('calendar', 'Sick day'),
		t('calendar', 'Special occasion'),
		t('calendar', 'Travel'),
		t('calendar', 'Vacation'),
	]
}
+49 −0
Original line number Diff line number Diff line
/**
 * @copyright Copyright (c) 2019 Georg Ehrke
 *
 * @author Georg Ehrke <oc.list@georgehrke.com>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
import getDefaultAlarms from '../../../../src/defaults/defaultAlarmProvider.js'

describe('defaults/defaultAlarmProvider test suite', () => {

	it('should provide default alarms for timed events', () => {
		expect(getDefaultAlarms()).toEqual([
			0,
			-300,
			-600,
			-900,
			-1800,
			-3600,
			-7200,
			-86400,
			-172800,
		])
	})

	it('should provide default alarms for all-day events', () => {
		expect(getDefaultAlarms(true)).toEqual([
			32400,
			-54000,
			-140400,
			-572400,
		])
	})

})
+46 −0
Original line number Diff line number Diff line
/**
 * @copyright Copyright (c) 2019 Georg Ehrke
 *
 * @author Georg Ehrke <oc.list@georgehrke.com>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
import defaultCategories from '../../../../src/defaults/defaultCategories.js'

describe('defaults/defaultCategories test suite', () => {

	it('should provide a default set of categories', () => {
		expect(defaultCategories()).toEqual([
			'TRANSLATED:Anniversary',
			'TRANSLATED:Appointment',
			'TRANSLATED:Business',
			'TRANSLATED:Education',
			'TRANSLATED:Holiday',
			'TRANSLATED:Meeting',
			'TRANSLATED:Miscellaneous',
			'TRANSLATED:Non-working hours',
			'TRANSLATED:Not in office',
			'TRANSLATED:Personal',
			'TRANSLATED:Phone call',
			'TRANSLATED:Sick day',
			'TRANSLATED:Special occasion',
			'TRANSLATED:Travel',
			'TRANSLATED:Vacation',
		])
	})

})