Assertion library for Google Apps Script. Compatible with GASUnit.
project key: MWRSRXxKQuT_xRUeAjNzn4TVZgzu5bsVr
var exports = GASUnit.exports
var assertThat = AssertGAS.assertThat
function test_array () {
exports({
'Array': {
'#indexOf()': {
'should return -1 when not present': function () {
var index = [1, 2, 3].indexOf(4)
assertThat(index).is(-1)
},
'should return the index when present': function () {
var index = [1, 2, 3].indexOf(3)
assertThat(index).is(2)
}
}
}
})
}
API is inspired by AssertJ.
assertThat('foo').matches(function (value) {
return value.startsWith('f')
})
assertThat('bar').doesNotMatch(function (value) {
return value.startsWith('f')
})
assertThat('foo').is('foo')
assertThat('foo').isNot('bar')
assertThat(null).isNull()
assertThat(undefined).isNotNull()
assertThat(undefined).isUndefined()
assertThat(null).isNotUndefined()
assertThat(true).isTrue()
assertThat(false).isFalse()
See package.json