You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.js 666B

123456789101112131415161718192021222324
  1. var sep = require('path').sep || '/';
  2. var assert = require('assert');
  3. var uri2path = require('../');
  4. var tests = require('./tests.json');
  5. describe('file-uri-to-path', function () {
  6. Object.keys(tests).forEach(function (uri) {
  7. // the test cases were generated from Windows' PathCreateFromUrlA() function.
  8. // On Unix, we have to replace the path separator with the Unix one instead of
  9. // the Windows one.
  10. var expected = tests[uri].replace(/\\/g, sep);
  11. it('should convert ' + JSON.stringify(uri) + ' to ' + JSON.stringify(expected),
  12. function () {
  13. var actual = uri2path(uri);
  14. assert.equal(actual, expected);
  15. });
  16. });
  17. });