Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ describe('Automated tests', function () {
before(function () {
// runs once before the first test in this block
let { basket } = testItems;
if(typeof basket === 'array') {
if (typeof basket === 'array') {
originalBasket = [...basket];
}
}
});
after(function () {
// runs once after the last test in this block
if(typeof basket === 'array') {
if (typeof basket === 'array') {
basket = [...originalBasket];
}
}
});
describe('Created global variable for `basket` as empty array', function () {
it('Created global variable for `basket` as empty array', function () {
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('Automated tests', function () {
basket.length = 0;
basket.push('Kale', 'Spinach');
let tempLog = console.log;

// Temporarily override console.log
console.log = (item) => result += item;
listItems(basket);
Expand All @@ -95,6 +95,7 @@ describe('Automated tests', function () {
expect(result).to.be.a('string');
assert.equal(result.includes('Kale'), true);
assert.equal(result.includes('Spinach'), true);
basket.length = 0;
});
});
describe(`Functions are tested using console.log()`, function () {
Expand Down