Skip to content

Commit

Permalink
chore: add test package before publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
onedionys committed Mar 8, 2024
1 parent b77d080 commit edc7de2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const assert = require('assert');
const ProgressBar = require('../src/progress-bar');

describe('ProgressBar', function() {
describe('#getProgress()', function() {
it('should return 0 when no progress is set', function() {
const progressBar = new ProgressBar(100);
assert.strictEqual(progressBar.getProgress(), 0);
});

it('should return correct progress value', function() {
const progressBar = new ProgressBar(100);
progressBar.setProgress(50);
assert.strictEqual(progressBar.getProgress(), 50);
});

it('should throw an error for invalid progress value', function() {
const progressBar = new ProgressBar(100);
assert.throws(() => {
progressBar.setProgress(-1);
}, Error);
assert.throws(() => {
progressBar.setProgress(101);
}, Error);
});
});
});

0 comments on commit edc7de2

Please sign in to comment.