Files
n8n-nodes-strike/node_modules/lazystream/test/fs_test.js
Martien 5605b9b49a Initial commit: n8n Strike API node
- Add Strike API credentials configuration
- Implement Strike node with 9 resources (Account, Balance, Currency Exchange, Deposit, Invoice, Payment, Payment Method, Payout, Rates)
- Add comprehensive operation descriptions for all resources
- Include CLAUDE.MD documentation
- Set up build configuration with TypeScript, ESLint, and Prettier

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 11:00:38 +01:00

70 lines
1.6 KiB
JavaScript

var stream = require('../lib/lazystream');
var fs = require('fs');
var tmpDir = 'test/tmp/';
var readFile = 'test/data.md';
var writeFile = tmpDir + 'data.md';
exports.fs = {
readwrite: function(test) {
var readfd, writefd;
var readable = new stream.Readable(function() {
return fs.createReadStream(readFile)
.on('open', function(fd) {
readfd = fd;
})
.on('close', function() {
readfd = undefined;
step();
});
});
var writable = new stream.Writable(function() {
return fs.createWriteStream(writeFile)
.on('open', function(fd) {
writefd = fd;
})
.on('close', function() {
writefd = undefined;
step();
});
});
test.expect(3);
test.equal(readfd, undefined, 'Input file should not be opened until read');
test.equal(writefd, undefined, 'Output file should not be opened until write');
if (!fs.existsSync(tmpDir)) {
fs.mkdirSync(tmpDir);
}
if (fs.existsSync(writeFile)) {
fs.unlinkSync(writeFile);
}
readable.on('end', function() { step(); });
writable.on('end', function() { step(); });
var steps = 0;
function step() {
steps += 1;
if (steps == 4) {
var input = fs.readFileSync(readFile);
var output = fs.readFileSync(writeFile);
test.ok(input >= output && input <= output, 'Should be equal');
fs.unlinkSync(writeFile);
fs.rmdirSync(tmpDir);
test.done();
}
};
readable.pipe(writable);
}
};