summaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/useragent/bin/testfiles.js
blob: f01a6d7a9706bebaf1f6afa945e120cdc7494af7 (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
#!/usr/bin/env node

var request = require('request')
  , path = require('path')
  , fs = require('fs');

var files = {
    'pgts.yaml': 'https://raw.github.com/tobie/ua-parser/master/test_resources/pgts_browser_list.yaml'
  , 'testcases.yaml': 'https://raw.github.com/tobie/ua-parser/master/test_resources/test_user_agent_parser.yaml'
  , 'firefoxes.yaml': 'https://raw.github.com/tobie/ua-parser/master/test_resources/firefox_user_agent_strings.yaml'
};

/**
 * Update the fixtures
 */

Object.keys(files).forEach(function (key) {
  request(files[key], function response (err, res, data) {
    if (err || res.statusCode !== 200) return console.error('failed to update');

    console.log('downloaded', files[key]);
    fs.writeFileSync(path.join(__dirname, '..', 'tests', 'fixtures', key), data);
  });
});