nodes.forEach(function(res){
        var expressionId = res.expression_id;
        var resourceId = res.id;
        
        var expression = Object.assign(
            {}, 
            res,
            expressionById[expressionId]
        );
        
        var resourceAnnotations = resourceAnnotationsById ? resourceAnnotationsById[resourceId] : undefined;
                
        // Sometimes, prepareResourceForTerritoire isn't done yet and 
        // the ResourceAnnotation is created while there is no expression domain yet.
        // as a consequence, resourceAnnotationsById does not have the resource id as key
        // Skip these resources
        if(resourceAnnotations){
            var expressionDomainId = resourceAnnotations.expression_domain_id;

            var expressionDomainAnnotations = expressionDomainAnnotationsById[expressionDomainId];

            var name = nextNodeName();

            var publicationDate = typeof resourceAnnotations.publication_date === 'string' ?
                resourceAnnotations.publication_date : undefined;
            
            var lifetime = publicationDate ? {start: moment(publicationDate).format('YYYY-MM-DD')} : undefined;
            
            pageGraph.addNode(name, Object.assign(
                {
                    url: res.url,
                    depth: expression.depth,
                    title: expression.title || '',
                    expressionId: typeof expressionId === "string" ? expressionId : '',
                    resource_id: resourceId
                }, 
                resourceAnnotations,
                {
                    media_type: expressionDomainAnnotations.media_type || '',
                    tags: resourceAnnotations.tags.toJSON().join(', '),
                    sentiment: resourceAnnotations.sentiment || undefined,
                    favorite: typeof resourceAnnotations.favorite === 'boolean' ? resourceAnnotations.favorite : undefined,
                    publication_date: publicationDate ? moment(publicationDate).format('YYYY-MM-DD') : '',
                    
                    created_at: undefined,
                    updated_at: undefined,
                    user_id: undefined,
                    approved: undefined
                }
            ), lifetime);

            var urlToNodeNameKey = res.id;
            //console.log(urlToNodeNameKey);

            urlToNodeName.set(urlToNodeNameKey, name);
        }
    });
  beforeEach(function() {

    docs = [{ file: 'a.b.js' }];

    exampleMap = new StringMap();

    files = {};

    files['index.html'] = { type: 'html', name: 'index.html', fileContents: 'index.html content' };
    files['app.js'] = { type: 'js', name: 'app.js', fileContents: 'app.js content' };
    files['app.css'] = { type: 'css', name: 'app.css', fileContents: 'app.css content' };
    files['app.spec.js'] = { type: 'spec', name: 'app.spec.js', fileContents: 'app.spec.js content' };

    exampleMap.set('a.b.c', {
      id: 'a.b.c',
      doc: docs[0],
      outputFolder: 'examples',
      deps: 'dep1.js;dep2.js',
      files: files,
      deployments: {}
    });

    processor = generateExamplesProcessorFactory(mockLog, exampleMap);
    processor.templateFolder = 'examples';
    processor.deployments = [
      {
        name: 'default',
        examples: { commonFiles: [], dependencyPath: '.' },
      },
      {
        name: 'other',
        examples: { commonFiles: { scripts: [ 'someFile.js', 'someOtherFile.js' ], }, dependencyPath: '..' }
      }
    ];

    processor.$process(docs);

  });
 options.rename.forEach(function(value) {
     rename.set(value.from, value.to);
 });
 receivedNodes.forEach(function(n){
     //console.log('n.id', n.id, typeof n.id);
     
     if(!rejectedResourceIds.has(n.id))
         nodes.set(String(n.id), n);
 });