import { NotImplementedError } from 'bitbucket/internal/bbui/javascript-errors/javascript-errors';

QUnit.module('bitbucket-javascript-errors');

QUnit.test('NotImplementedError', function(assert) {
    class Foo {
        implemented() {
            throw new NotImplementedError();
        }

        notImplemented() {
            throw new NotImplementedError();
        }

        customError() {
            throw new NotImplementedError("Custom message");
        }
    }
    class Bar extends Foo {
        implemented() {
            return true;
        }
    }
    const foobar = new Bar();
    assert.throws(() => foobar.notImplemented(), new NotImplementedError(), "throws for abstract methods");
    assert.throws(() => foobar.customError(), /Custom message/, "can be passed a custom message");
    assert.ok(foobar.implemented(), "implemented methods don't throw");
});
