class{
function run(){
describe( "My calculator features", () => {
beforeEach( () => {
variables.calc = new Calculator()
} )
// Using expectations library
it( "can add", () => {
expect( calc.add(1,1) ).toBe( 2 )
} )
// Using assert library
test( "it can multiply", () => {
assertIsEqual( calc.multiply(2,2), 4 )
} )
} )
}
}
/**
* My calculator features
*/
class{
property calc;
function setup(){
calc = new Calculator()
}
// Function name includes the word 'test'
// Using expectations library
function testAdd(){
expect( calc.add(1,1) ).toBe( 2 )
}
// Any name, but with a test annotation
// Using assertions library
@test
function itCanMultiply(){
assertIsEqual( calc.multiply(2,2), 4 )
}
}
component{
function run(){
describe( "My calculator features", () => {
beforeEach( () => {
variables.calc = new Calculator()
} );
// Using expectations library
it( "can add", () => {
expect( calc.add(1,1) ).toBe( 2 )
} );
// Using assert library
test( "it can multiply", () => {
$assert.isEqual( calc.multiply(2,2), 4 )
} );
} );
}
}
/**
* My calculator features
*/
component{
property calc;
function setup(){
calc = new Calculator()
}
// Function name includes the word 'test'
// Using expectations library
function testAdd(){
expect( calc.add(1,1) ).toBe( 2 )
}
// Any name, but with a test annotation
// Using assertions library
function itCanMultiply() test{
$assert.isEqual( calc.multiply(2,2), 4 )
}
}