react / react-0.13.3 / examples / basic-commonjs / node_modules / browserify / node_modules / buffer / test / base64.js
80724 viewsvar B = require('../').Buffer1var test = require('tape')2if (process.env.OBJECT_IMPL) B.TYPED_ARRAY_SUPPORT = false345test('base64: ignore whitespace', function (t) {6var text = '\n YW9ldQ== '7var buf = new B(text, 'base64')8t.equal(buf.toString(), 'aoeu')9t.end()10})1112test('base64: strings without padding', function (t) {13t.equal((new B('YW9ldQ', 'base64').toString()), 'aoeu')14t.end()15})1617test('base64: newline in utf8 -- should not be an issue', function (t) {18t.equal(19new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK', 'base64').toString('utf8'),20'---\ntitle: Three dashes marks the spot\ntags:\n'21)22t.end()23})2425test('base64: newline in base64 -- should get stripped', function (t) {26t.equal(27new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\nICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),28'---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'29)30t.end()31})3233test('base64: tab characters in base64 - should get stripped', function (t) {34t.equal(35new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\t\t\t\tICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),36'---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'37)38t.end()39})40414243