This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Foo", (): void => { | |
todo("Test #bar"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myFoo = new Foo(); | |
describe("Foo.divide()", (): void => { | |
it("should throw when dividing by zero", (): void => { | |
expectFn((): void => { myFoo.divide(42, 0); }) | |
.toThrow("Dividing by zero should throw an error."); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myFoo = new Foo(); | |
describe("Foo.divide()", (): void => { | |
throws("when dividing by zero", (): void => { | |
myFoo.divide(42, 0); | |
}, "Dividing by zero should throw an error."); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myFoo: Foo = new Foo(); | |
describe("Foo", (): void => { | |
describe("#add()", (): void => { | |
// Reads like: Foo#add() should add two integers togehter | |
it("should add two integers together", (): void => { | |
expect<i32>(myFoo.add(19, 23)).toBe(42, "19 + 23 should be 42"); | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Foo class", (): void => { | |
describe("#.bar()", (): void => { | |
// put the `#.bar()` tests here! | |
}); | |
describe("#.baz()", (): void => { | |
// put the `#.baz()` tests here! | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("example", (): void => { | |
it("should be meaninful", (): void => { | |
expect<i32>(19 + 23).toBe(42, "42 is the meaning of life."); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Folder: assembly/__tests__/ | |
File: assembly/__tests__/as-pect.d.ts | |
File: assembly/__tests__/example.spec.ts | |
File: as-pect.config.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save-dev assemblyscript @as-pect/cli | |
npx asinit . | |
npx asp --init | |
# To run your test suite | |
npx asp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rbush = require( "rbush" ); | |
const ctx = document.createElement( "canvas" ).getContext( "2d" ); | |
const width = ctx.canvas.width = 800; | |
const height = ctx.canvas.height = 600; | |
const e2d = require( "e2d" ); | |
document.body.appendChild( ctx.canvas ); | |
const tree = rbush(); | |
const rects = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const repatch = require('repatch'); | |
const e2d = require('e2d'); | |
const components = []; | |
const app = { pointer: false, mouseData: null, activeRegions: null }; | |
const ctx = document.createElement('canvas').getContext('2d'); | |
ctx.canvas.width = 400; | |
ctx.canvas.height = 300; | |
document.body.appendChild(ctx.canvas); | |
e2d.raf(() => { |