Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for the build pipeline #493

Merged
merged 2 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/lib/tests/build-pipeline-dynamic-import.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function blah(x: number) {
return x + 1;
}
44 changes: 44 additions & 0 deletions frontend/lib/tests/build-pipeline.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import autobind from 'autobind-decorator';

test("dynamic import works", () => {
return import('./build-pipeline-dynamic-import').then(mod => {
expect(mod.blah(5)).toEqual(6);
});
});

test('autobind decorator works', () => {
class Blarg {
constructor(readonly base: number) {}

@autobind
boop(x: number) {
return this.base + x;
}
}

const blarg = new Blarg(6);
const boop = blarg.boop;

expect(boop(1)).toEqual(7);
});

test('super() works', () => {
class Foo {
thingy: number;

constructor() {
this.thingy = 1;
}
}

class Bar extends Foo {
constructor() {
super()
this.thingy += 1;
}
}

const bar = new Bar();

expect(bar.thingy).toEqual(2);
});