Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,212 @@
define(function(require) {
'use strict';
var Abstract = require('provider/abstract');
var Factory = require('test/support/factory');
var Local = require('provider/local');
var core = require('core');
suite('provider/local', function() {
var subject;
var db;
var storeFactory;
setup(function(done) {
subject = new Local();
storeFactory = core.storeFactory;
db = core.db;
db.open(function(err) {
assert.ok(!err);
done();
});
});
teardown(function(done) {
testSupport.calendar.clearStore(
db,
['accounts', 'calendars', 'events', 'busytimes'],
done
);
});
teardown(function() {
db.close();
});
test('initialization', function() {
assert.instanceOf(subject, Abstract);
});
test('#getAccount', function(done) {
subject.getAccount({}, function(err, success) {
assert.ok(!err);
assert.deepEqual(success, {});
done();
});
});
/* disabled in Bug 838993, to be reenabled asap in Bug 840489.
* this happens when using a firefox launched with a french locale, we
* probably need to mock the l10n library instead of using it.
*
* 1) [calendar] provider/local #findCalendars:
* Error: expected 'Agenda hors-ligne' to equal 'Offline calendar'
*
test('#findCalendars', function(done) {
// local will always return the same
// calendar id
subject.findCalendars({}, function(err, list) {
done(function() {
var first = list['local-first'];
assert.equal(first.id, 'local-first');
assert.equal(first.name, 'Offline calendar');
});
});
});
*/
suite('mutations', function() {
var events;
var busytimes;
setup(function() {
events = storeFactory.get('Event');
busytimes = storeFactory.get('Busytime');
});
function find(eventId, done) {
var trans = db.transaction(
events._dependentStores,
'readwrite'
);
trans.oncomplete = function() {
done(busytime, event);
};
var event;
var busytime;
events.get(eventId, trans, function(err, record) {
event = record;
});
var index = trans.objectStore('busytimes').index('eventId');
index.get(eventId).onsuccess = function(e) {
busytime = e.target.result;
};
}
suite('#createEvent', function() {
var event;
function verify(done) {
subject.createEvent(event, function() {
find(event._id, function(busytime, event) {
done(function() {
assert.deepEqual(event, event);
});
});
});
}
test('without remote.id', function(done) {
event = Factory('event');
delete event.remote.id;
delete event._id;
verify(done);
assert.ok(event.remote.id, 'adds id');
});
test('with remote.id', function(done) {
event = Factory('event');
delete event._id;
var id = event.remote.id;
verify(done);
assert.equal(event.remote.id, id, 'id change');
});
});
suite('#updateEvent', function() {
//XXX: in the future we should skip the saving.
suite('update with same values', function() {
var event;
var busytime;
setup(function(done) {
event = Factory('event');
subject.createEvent(event, done);
});
setup(function(done) {
subject.updateEvent(event, busytime, function(err, busy, ev) {
event = ev;
busytime = busy;
done();
});
});
test('event', function(done) {
assert.ok(event);
events.count(function(err, count) {
done(function() {
assert.equal(count, 1);
});
});
});
test('busytime', function(done) {
assert.hasProperties(busytime, {
eventId: event._id, calendarId: event.calendarId
});
busytimes.count(function(err, count) {
done(function() {
assert.equal(count, 1);
});
});
});
});
});
suite('#deleteEvent', function() {
var event;
setup(function(done) {
event = Factory('event');
subject.createEvent(event, done);
});
setup(function(done) {
subject.deleteEvent(event, done);
});
test('busytime count', function(done) {
busytimes.count(function(err, count) {
done(function() {
assert.equal(count, 0);
});
});
});
test('event count', function(done) {
events.count(function(err, count) {
done(function() {
assert.equal(count, 0);
});
});
});
});
});
});
});