MCPcopy
hub / github.com/node-red/node-red / checkReadWithEncoding

Function checkReadWithEncoding

test/nodes/core/storage/10-file_spec.js:1533–1553  ·  view source on GitHub ↗
(enc, data, done)

Source from the content-addressed store, hash-verified

1531 describe('encodings', function() {
1532
1533 function checkReadWithEncoding(enc, data, done) {
1534 var flow = [{id:"fileInNode1", type:"file in", name: "fileInNode", "filename":fileToTest, "format":"utf8", encoding:enc, wires:[["n2"]]},
1535 {id:"n2", type:"helper"}];
1536
1537 fs.writeFileSync(fileToTest, encode(data, enc));
1538 helper.load(fileNode, flow, function() {
1539 var n1 = helper.getNode("fileInNode1");
1540 var n2 = helper.getNode("n2");
1541 n2.on("input", function(msg) {
1542 try {
1543 msg.should.have.property('payload');
1544 msg.payload.should.be.a.String();
1545 msg.payload.should.equal(data);
1546 done();
1547 } catch(err) {
1548 done(err);
1549 }
1550 });
1551 n1.receive({payload:""});
1552 });
1553 }
1554
1555 // default
1556 it('should read in a file with "none" encoding', function(done) {

Callers 1

10-file_spec.jsFile · 0.85

Calls 1

encodeFunction · 0.85

Tested by

no test coverage detected