basic.js 2.4 KB

123456789101112131415
  1. var tap = require('tap');
  2. var qrcode = require('../qrcode');
  3. tap.test('basic', function(t) {
  4. var text = 'Hello World';
  5. var qr = qrcode.qrcode(4, 'M');
  6. qr.addData(text);
  7. qr.make();
  8. var imgTag = qr.createImgTag(4);
  9. t.deepEqual(imgTag, '<img src="data:image/gif;base64,R0lGODdhpACkAIAAAAAAAP///ywAAAAApACkAAAC/4yPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXTAjgCY1Kp1QGVWqtXq6IaPcKDpPCZK2inJ1iuAdvuwx/juPwNNjutrAN+QC9PvKHtjB4Zlax5wf1JXgXuLgFaag2kdiX6CSJqAnSR+H5RilhqYn5ADrK+YEawWrqQCoXilWpmiorwpqJm/DaEAvASHsbHMnbWUomvExoqyi6CX2ZLDY7x1v4XMzn7Hr4eTiNrWz9OF7Nfb7d2/1dK029nq27Ie6YLt9+PEsPGx4vDNi1fOi0BXS2ax2zSQrL4TsIb58HewL5ITylr+HDZv/qIA4zaI7gPZD4+v3KaCelQ20Vc8VryfKiP4kk2dG05xFnyJwAV/JspHLjTJEwkamD6a2RL51Df4oc6HRhTad/gk7lSPQfTQ4UtT7FqvSjVJNdI2rsYNJqNo9qMxZ9d5arzJNH3ZVE6dOi2TVz+W7FWBcaW6xSo+YlBtVYVsF6zzK1OTIt4ZBhH1vuKbTm5cpiV3H+uPlr5tBjP0vWYxqzZtWkV5atPNB06Y6uWdsODHvI66VKrTap95Icw6qTf8vFzRtoceMadtuNGce37uDRwd6Ou5z43eoqnBccPLpvbe7QAXWnbh5ya8SNgWlP4X0k+NV/GVJFv/aFr/vk35//hozHcyjs115vBe6lWICMnbegep/xJ1o0jgnXAoHb5XbhW+wNJ+AKSUUYX1s3UahgZzJ8ONtiJtI34XfWNQgDiuOpKGNmhg1lYYV4hYfcjldlOFd+JtTIYnwfvpdiQjke1yKIXglZHpSPlfifX02maKRbdIiIHZD1oeXjaxBSSeKMS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