client/src/api/__tests__/WebAnnotationSerializer.test.js
changeset 102 b0e36664f1f2
parent 98 2e939d9cf193
equal deleted inserted replaced
101:e165aa89ac82 102:b0e36664f1f2
     6 
     6 
     7   const category = {
     7   const category = {
     8     "key": "keyword",
     8     "key": "keyword",
     9     "name": "Mot-clé",
     9     "name": "Mot-clé",
    10     "color": "#2ECC71",
    10     "color": "#2ECC71",
    11     "text": "Foo"
    11     "text": "Foo",
       
    12     "selection": {
       
    13       "start": 0,
       
    14       "end": 10,
       
    15     },
    12   };
    16   };
    13 
    17 
    14   const comment = {
    18   const comment = {
    15     "key": "comment",
    19     "key": "comment",
    16     "name": "Commentaire",
    20     "name": "Commentaire",
    17     "color": "#3498DB",
    21     "color": "#3498DB",
    18     "hasComment": true,
    22     "hasComment": true,
    19     "comment": "Bar",
    23     "comment": "Bar",
    20     "text": "Baz"
    24     "text": "Baz",
       
    25     "selection": {
       
    26       "start": 0,
       
    27       "end": 10,
       
    28     },
    21   }
    29   }
    22 
    30 
    23   const note = new Note({
    31   const note = new Note({
    24     _id: '123456',
    32     _id: '123456',
    25     session: '9876543',
    33     session: '9876543',
    43       "@context": "http://www.w3.org/ns/anno.jsonld",
    51       "@context": "http://www.w3.org/ns/anno.jsonld",
    44       "type": "Annotation",
    52       "type": "Annotation",
    45       "id": 0,
    53       "id": 0,
    46       "target": {
    54       "target": {
    47         "source": "/session/9876543/notes/123456",
    55         "source": "/session/9876543/notes/123456",
    48         "selector": {
    56         "selector": [
    49           "type": "TextQuoteSelector",
    57           {
    50           "exact": "Foo"
    58             "type": "TextQuoteSelector",
    51         }
    59             "exact": "Foo"
       
    60           },
       
    61           {
       
    62             "type": "TextPositionSelector",
       
    63             "start": 0,
       
    64             "end": 10
       
    65           }
       
    66         ]
    52       }
    67       }
    53     },
    68     },
    54     {
    69     {
    55       "@context": "http://www.w3.org/ns/anno.jsonld",
    70       "@context": "http://www.w3.org/ns/anno.jsonld",
    56       "type": "Annotation",
    71       "type": "Annotation",
    60         "value": "Bar",
    75         "value": "Bar",
    61         "format": "text/plain"
    76         "format": "text/plain"
    62       },
    77       },
    63       "target": {
    78       "target": {
    64         "source": "/session/9876543/notes/123456",
    79         "source": "/session/9876543/notes/123456",
    65         "selector": {
    80         "selector": [
    66           "type": "TextQuoteSelector",
    81           {
    67           "exact": "Baz"
    82             "type": "TextQuoteSelector",
    68         }
    83             "exact": "Baz"
       
    84           },
       
    85           {
       
    86             "type": "TextPositionSelector",
       
    87             "start": 0,
       
    88             "end": 10
       
    89           }
       
    90         ]
    69       }
    91       }
    70     }
    92     }
    71   ];
    93   ];
    72 
    94 
    73   // console.log(JSON.stringify(actual, null, 2));
    95   // console.log(JSON.stringify(actual, null, 2));