diff options
| author | akiyamn | 2023-09-24 23:22:21 +1000 |
|---|---|---|
| committer | akiyamn | 2023-09-24 23:22:21 +1000 |
| commit | 4e87195739f2a5d9a05451b48773c8afdc680765 (patch) | |
| tree | 9cba501844a4a11dcbdffc4050ed8189561c55ed /node_modules/get-source/test/test.path.js | |
| download | price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.tar.gz price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.zip | |
Initial commit (by create-cloudflare CLI)
Diffstat (limited to 'node_modules/get-source/test/test.path.js')
| -rw-r--r-- | node_modules/get-source/test/test.path.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/node_modules/get-source/test/test.path.js b/node_modules/get-source/test/test.path.js new file mode 100644 index 0000000..610ac2f --- /dev/null +++ b/node_modules/get-source/test/test.path.js @@ -0,0 +1,56 @@ +"use strict"; + +/* ------------------------------------------------------------------------ */ + +require ('chai').should () + +/* ------------------------------------------------------------------------ */ + +describe ('path', () => { + + const path = require ('../impl/path') + + it ('resolves', () => { + + path.resolve ('./foo/bar/../qux').should.equal (process.cwd () + '/foo/qux') + }) + + it ('normalizes', () => { + + path.normalize ('./foo/./bar/.././.././qux.map./').should.equal ('qux.map./') + + path.normalize ('/a/b').should.equal ('/a/b') + path.normalize ('http://foo/bar').should.equal ('http://foo/bar') + }) + + it ('computes relative location', () => { + + path.relativeToFile ('/foo/bar.js', './qux.map') + .should.equal ('/foo/qux.map') + + path.relativeToFile ('/foo/bar/baz.js', './../.././qux.map') + .should.equal ('/qux.map') + + path.relativeToFile ('/foo/bar', 'webpack:something') + .should.equal ('webpack:something') + + path.relativeToFile ('/foo/bar', 'web/pack:something') + .should.equal ('/foo/web/pack:something') + }) + + it ('works with data URIs', () => { + + path.relativeToFile ('/foo/bar.js', 'data:application/json;charset=utf-8;base64,eyJ2ZXJza==') + .should.equal ( 'data:application/json;charset=utf-8;base64,eyJ2ZXJza==') + + path.relativeToFile ('data:application/json;charset=utf-8;base64,eyJ2ZXJza==', 'foo.js') + .should.equal ( 'foo.js') + }) + + it ('implements isURL', () => { + + path.isURL ('foo.js').should.equal (false) + path.isURL ('/foo/bar.js').should.equal (false) + path.isURL ('https://google.com').should.equal (true) + }) +})
\ No newline at end of file |
