summaryrefslogtreecommitdiffstats
path: root/js/dav/test/unit/parser_test.js
blob: bd879d7101a0c88aa2d7cab467d3c4365e250e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { assert } from 'chai';

import { multistatus } from '../../lib/parser';
import data from './data';

suite('parser.multistatus', function() {
  test('propfind (current-user-principal)', function() {
    let currentUserPrincipal = data.currentUserPrincipal;
    assert.deepEqual(multistatus(currentUserPrincipal), {
      response: [{
        href: '/',
        propstat: [{
          prop: {
            currentUserPrincipal: '/principals/admin@domain.tld/'
          },
          status: 'HTTP/1.1 200 OK'
        }]
      }]
    });
  });

  test('report (calendar-query)', function() {
    let calendarQuery = data.calendarQuery;
    assert.deepEqual(multistatus(calendarQuery), {
      response: [
        {
          href: '/calendars/johndoe/home/132456762153245.ics',
          propstat: [{
            prop: {
              getetag: '"2134-314"',
              calendarData: 'BEGIN:VCALENDAR\nEND:VCALENDAR'
            },
            status: 'HTTP/1.1 200 OK'
          }]
        },
        {
          href: '/calendars/johndoe/home/132456-34365.ics',
          propstat: [{
            prop: {
              getetag: '"5467-323"',
              calendarData: 'BEGIN:VCALENDAR\nEND:VCALENDAR'
            },
            status: 'HTTP/1.1 200 OK'
          }]
        },
      ]
    });
  });

  test('report (sync-collection)', function() {
    let syncCollection = data.syncCollection;
    assert.deepEqual(multistatus(syncCollection), {
      response: [{
        href: '/calendars/admin/default/test.ics',
        propstat: [{
          prop: {
            'calendarData': 'BEGIN:VCALENDAR\nEND:VCALENDAR\n',
            getetag: '"e91f3c9518f76753a7dc5a0cf8998986"'
          },
          status: 'HTTP/1.1 200 OK'
        }]
      }],
      syncToken: 'http://sabre.io/ns/sync/3'
    });
  });
});