Skip to content

Commit

Permalink
Update test file format and fix test name
Browse files Browse the repository at this point in the history
  • Loading branch information
vishal diyora authored and vishal diyora committed Mar 16, 2024
1 parent 7e42397 commit 29bf21a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/test1889.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ var test = '1889'; // insert test file number
describe('Test 1889 - Ensure utils.isNode handles node and non-Node environments', function () {
let originalProcess;

before(function() {
// Store the original process object
originalProcess = global.process;
});
before(function () {
// Store the original process object
originalProcess = global.process;
});

after(function() {
// Restore the original process object after all tests
global.process = originalProcess;
});
after(function () {
// Restore the original process object after all tests
global.process = originalProcess;
});

it('Positive: Detect Node environment', function () {
// No modification needed here, running in actual Node.js environment
const isNode = alasql.utils.isNode;
assert.strictEqual(isNode, true, 'utils.isNode should return true in a Node.js environment');
// No modification needed here, running in actual Node.js environment
const isNode = alasql.utils.isNode;
assert.strictEqual(isNode, true, 'utils.isNode should return true in a Node.js environment');
});

it('Negative: Detect Node environment', function () {
it('Negative: Should not detect as Node environment', function () {
// Temporarily override the global process object
global.process = null;
global.process = null;

delete require.cache[require.resolve('..')];
const reloadedAlasql = require('..');

const isNodeAfterModification = reloadedAlasql.utils.isNode;
assert.strictEqual(isNodeAfterModification, false, 'utils.isNode should return true in a Node.js environment');
});
assert.strictEqual(isNodeAfterModification, false, 'utils.isNode should return false when not in nodejs environment');
});

});

0 comments on commit 29bf21a

Please sign in to comment.