unpkg/modules/__tests__/BlacklistAPI-test.js

25 lines
688 B
JavaScript
Raw Normal View History

2018-12-17 17:38:05 +00:00
const BlacklistAPI = require('../BlacklistAPI');
2017-11-11 20:18:13 +00:00
2018-12-17 17:38:05 +00:00
describe('Blacklist API', () => {
2017-11-11 20:18:13 +00:00
beforeEach(done => {
2018-02-18 02:00:56 +00:00
BlacklistAPI.removeAllPackages().then(() => done(), done);
});
2017-11-11 20:18:13 +00:00
2018-12-17 17:38:05 +00:00
it('adds and removes packages to/from the blacklist', done => {
const packageName = 'bad-package';
2017-11-11 20:18:13 +00:00
BlacklistAPI.addPackage(packageName).then(() => {
BlacklistAPI.getPackages().then(packageNames => {
2018-02-18 02:00:56 +00:00
expect(packageNames).toEqual([packageName]);
2017-11-11 20:18:13 +00:00
BlacklistAPI.removePackage(packageName).then(() => {
BlacklistAPI.getPackages().then(packageNames => {
2018-02-18 02:00:56 +00:00
expect(packageNames).toEqual([]);
done();
});
});
});
});
});
});