@polkadot/dev
Version:
A collection of shared CI scripts and development environment used by @polkadot projects
45 lines (44 loc) • 1.47 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.runTests = runTests;
function runTests({ Clazz, TEST_PURE, bigIntExp, dynamic, jsOpExp, json }) {
describe('Clazz', () => {
it('has staticProperty', () => {
expect(Clazz.staticProperty).toBe('foobar');
});
it('creates an instance with get/set', () => {
const c = new Clazz(456);
expect(c.something).toBe(123_456_789 & 456);
c.setSomething(123);
expect(c.something).toBe(123 & 456);
});
});
describe('TEST_PURE', () => {
it('should have the correct value', () => {
expect(TEST_PURE).toBe('testRoot');
});
});
describe('dynamic()', () => {
it('should allow dynamic import usage', async () => {
expect(await dynamic(5, 37)).toBe(42);
});
});
describe('bigIntExp()', () => {
it('should return the correct value', () => {
expect(bigIntExp()).toBe(123456789n * 137858491849n);
});
});
describe('jsOpExp', () => {
it('handles 0 ?? 42 correctly', () => {
expect(jsOpExp(0)).toBe(0);
});
it('handles undefined ?? 42 correctly', () => {
expect(jsOpExp()).toBe(42);
});
});
describe('json()', () => {
it('should return the correct value', () => {
expect(json()).toBe('works');
});
});
}
;