Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(_`throws on invalid key ${key}`, function () {
const { sut } = setup();
assert.throws(() => sut.registerTransformer(key, null as any), /5/, `() => sut.registerTransformer(key, null as any)`);
});
}
it('throws when given anything not a Node but also not null/undefined', function () {
const { sut } = createFixture();
sut.value = true;
for (const imcompatValue of [true, false, 'a', 5, Symbol(), Number, new Date(), {}, [], new Proxy({}, {})]) {
assert.throws(() => sut.contains(imcompatValue as unknown as Element));
}
});
it('throws if channelOrType is undefined', function () {
assert.throws(() => { ea.publish(undefined, {}); }, 'Code 0');
});
it('undefined', function () {
assert.throws(() => BindingContext.get(undefined, undefined, undefined, LF.none), 'Code 250', `() => BindingContext.get(undefined, undefined, undefined, LF.none)`);
});
it('should require dynamic segment parameters when generating', function () {
const sut = new RouteRecognizer();
sut.add([dynamicRoute]);
assert.throws(() => sut.generate('dynamic'), void 0, `() => sut.generate('dynamic')`);
assert.throws(() => sut.generate('dynamic', {}), void 0, `() => sut.generate('dynamic', {})`);
assert.throws(() => sut.generate('dynamic', { id: null }), void 0, `() => sut.generate('dynamic', { id: null })`);
});
it('complains about empty input', function() {
assert.throws(() => nameConvention(''));
});
it('undefined', function () {
assert.throws(() => Scope.fromOverride(LF.none, undefined), 'Code 252', `() => Scope.fromOverride(LF.none, undefined)`);
});
assert.strictEqual(typeof sut['dispose'], 'function', `typeof sut['dispose']`);
assert.throws(() => sut.get(IViewFactory), /50/, `() => sut.get(IViewFactory)`);
assert.strictEqual(sut.get(IController), null, `sut.get(IController)`);
assert.strictEqual(sut.get(ITargetedInstruction), null, `sut.get(ITargetedInstruction)`);
assert.strictEqual(sut.get(IRenderLocation), null, `sut.get(IRenderLocation)`);
const renderable = {} as any;
const target = {} as any;
const instruction = {} as any;
const parts = {} as any;
const location = {} as any;
sut.beginComponentOperation(renderable, target, instruction, viewFactory as any, parts, location);
assert.throws(() => sut.get(IViewFactory), /51/, `() => sut.get(IViewFactory)`);
assert.strictEqual(sut.get(IController), renderable, `sut.get(IController)`);
assert.strictEqual(sut.get(INode), target, `sut.get(INode)`);
assert.strictEqual(sut.get(AuNode), target, `sut.get(AuNode)`);
assert.strictEqual(sut.get(ITargetedInstruction), instruction, `sut.get(ITargetedInstruction)`);
assert.strictEqual(sut.get(IRenderLocation), location, `sut.get(IRenderLocation)`);
});
});
attrs.forEach(attr => {
assert.throws(
() => compileWith(`<template></template>`, []),
/Invalid surrogate attribute/,
);
});
});
assert.strictEqual(sut['parent'], parent, `sut['parent']`);
assert.strictEqual(sut.has(IViewFactory, false), true, `sut.has(IViewFactory, false)`);
assert.strictEqual(sut.has(IController, false), true, `sut.has(IController, false)`);
assert.strictEqual(sut.has(ITargetedInstruction, false), true, `sut.has(ITargetedInstruction, false)`);
assert.strictEqual(sut.has(IRenderLocation, false), true, `sut.has(IRenderLocation, false)`);
assert.strictEqual(sut.has(Foo, false), true, `sut.has(Foo, false)`);
assert.strictEqual(sut.has(Bar, false), true, `sut.has(Bar, false)`);
assert.strictEqual(sut.has(INode, false), true, `sut.has(INode, false)`);
assert.strictEqual(sut.has(AuNode, false), true, `sut.has(AuNode, false)`);
assert.strictEqual(typeof sut.render, 'function', `typeof sut.render`);
assert.strictEqual(typeof sut.beginComponentOperation, 'function', `typeof sut.beginComponentOperation`);
assert.strictEqual(typeof sut['dispose'], 'function', `typeof sut['dispose']`);
assert.throws(() => sut.get(IViewFactory), /50/, `() => sut.get(IViewFactory)`);
assert.strictEqual(sut.get(IController), null, `sut.get(IController)`);
assert.strictEqual(sut.get(ITargetedInstruction), null, `sut.get(ITargetedInstruction)`);
assert.strictEqual(sut.get(IRenderLocation), null, `sut.get(IRenderLocation)`);
const renderable = {} as any;
const target = {} as any;
const instruction = {} as any;
const parts = {} as any;
const location = {} as any;
sut.beginComponentOperation(renderable, target, instruction, viewFactory as any, parts, location);
assert.throws(() => sut.get(IViewFactory), /51/, `() => sut.get(IViewFactory)`);
assert.strictEqual(sut.get(IController), renderable, `sut.get(IController)`);
assert.strictEqual(sut.get(INode), target, `sut.get(INode)`);
assert.strictEqual(sut.get(AuNode), target, `sut.get(AuNode)`);