mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 18:25:30 +00:00
Test method arity in standard library
This commit is contained in:
parent
dac6585675
commit
e7637b3b3c
1 changed files with 14 additions and 0 deletions
|
|
@ -24,6 +24,20 @@ for (const [key, Klass] of Object.entries(runtime)) {
|
|||
}
|
||||
expect(Parent.prototype.getclassname()).toBe(obj.parent);
|
||||
});
|
||||
describe("methods have the correct arity", () => {
|
||||
obj.functions.forEach(func => {
|
||||
const methodName = func.name.toLowerCase();
|
||||
// Once all methods are implemented this check can be removed.
|
||||
// For now we have a separate test which checks that we haven't
|
||||
// regressed on the methods we've implemented.
|
||||
if (Klass.prototype.hasOwnProperty(methodName)) {
|
||||
const actual = Klass.prototype[func.name.toLowerCase()].length;
|
||||
test(`${obj.name}.${func.name} has an arity of ${actual}`, () => {
|
||||
expect(func.parameters.length).toBe(actual);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue