-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
153 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('buffer').atob; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('buffer').btoa; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
describe('sandbox vendor - atob', function () { | ||
this.timeout(1000 * 60); | ||
var Sandbox = require('../../../'), | ||
context; | ||
|
||
beforeEach(function (done) { | ||
Sandbox.createContext({ debug: true }, function (err, ctx) { | ||
context = ctx; | ||
done(err); | ||
}); | ||
}); | ||
|
||
afterEach(function () { | ||
context.dispose(); | ||
context = null; | ||
}); | ||
|
||
it('should exist in global', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
assert.strictEqual(typeof atob, 'function', 'typeof atob must be function'); | ||
`, done); | ||
}); | ||
|
||
it('should be exposed via require', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
const atob = require('atob'); | ||
assert.strictEqual(typeof atob, 'function', 'typeof atob must be function'); | ||
`, done); | ||
}); | ||
|
||
it('should have same implementation exposed via global, require and buffer', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
const requiredAtob = require('atob'); | ||
const bufferAtob = require('buffer').atob; | ||
assert.strictEqual(atob === requiredAtob, true); | ||
assert.strictEqual(atob === bufferAtob, true); | ||
`, done); | ||
}); | ||
|
||
it('should decode base64 encoded string', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
const decoded = atob('cG9zdG1hbi1zYW5kYm94'); | ||
assert.strictEqual(decoded, 'postman-sandbox'); | ||
`, done); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
describe('sandbox vendor - btoa', function () { | ||
this.timeout(1000 * 60); | ||
var Sandbox = require('../../../'), | ||
context; | ||
|
||
beforeEach(function (done) { | ||
Sandbox.createContext({ debug: true }, function (err, ctx) { | ||
context = ctx; | ||
done(err); | ||
}); | ||
}); | ||
|
||
afterEach(function () { | ||
context.dispose(); | ||
context = null; | ||
}); | ||
|
||
it('should exist in global', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
assert.strictEqual(typeof btoa, 'function', 'typeof btoa must be function'); | ||
`, done); | ||
}); | ||
|
||
it('should be exposed via require', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
const btoa = require('btoa'); | ||
assert.strictEqual(typeof btoa, 'function', 'typeof btoa must be function'); | ||
`, done); | ||
}); | ||
|
||
it('should have same implementation exposed via global, require and buffer', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
const requiredBtoa = require('btoa'); | ||
const bufferBtoa = require('buffer').btoa; | ||
assert.strictEqual(btoa === requiredBtoa, true); | ||
assert.strictEqual(btoa === bufferBtoa, true); | ||
`, done); | ||
}); | ||
|
||
it('should encode a string to base64', function (done) { | ||
context.execute(` | ||
const assert = require('assert'); | ||
const decoded = btoa('postman-sandbox'); | ||
assert.strictEqual(decoded, 'cG9zdG1hbi1zYW5kYm94'); | ||
`, done); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters