function() { var v0 = new THREE.Vector3(); var v1 = new THREE.Vector3(); return function () { v0.subVectors( this.c, this.b ); v1.subVectors( this.a, this.b ); return v0.cross( v1 ).length() * 0.5; }; }()
lab.test('it calls ApiActions.get from getUser', (done) => { stub.ApiActions.get.mock = function (url, data, store, typeReq, typeRes, callback) { Code.expect(url).to.be.a.string(); Code.expect(data).to.be.undefined(); Code.expect(store).to.be.an.object(); Code.expect(typeReq).to.be.an.instanceof(FluxConstant); Code.expect(typeRes).to.be.an.instanceof(FluxConstant); Code.expect(callback).to.not.exist(); done(); }; Actions.getUser(); });
it('.stop()', async function() { this.polly.mode = MODES.RECORD; expect(this.polly.mode).to.equal(MODES.RECORD); const promise = this.polly.stop(); expect(promise).to.be.a('promise'); await promise; expect(this.polly.mode).to.equal(MODES.STOPPED); });
t('Multiple statements', async() => [2, await sql.unsafe(` select 1 as x; select 2 as a; `).then(([, [x]]) => x.a)] )
gpu.createKernel(function(a) { const pixel = a[this.thread.y][this.thread.x]; return pixel.a * 255; }, { output: [image.width, image.height], precision: 'unsigned', argumentTypes: { a: 'HTMLImage' }, })
var findUncaughtFrozen = function (store, key) { return arrayFind(store.a, function (it) { return it[0] === key; }); }
describe('Unit | Adapter', function() { it('should exist', function() { expect(Adapter).to.be.a('function'); }); });
it('should have access to context in beforeFind hook', async () => { Parse.Cloud.beforeFind('TestObject', (req) => { expect(req.context.a).toEqual('a'); }); const query = new Parse.Query('TestObject'); return query.find({ context: { a: 'a' } }); });
it('.emit()', async function() { expect(emitter.emit('a')).to.be.a('promise'); const array = []; emitter.on('a', () => array.push(1)); emitter.on('a', async () => { await timeout(10); array.push(2); }); emitter.on('a', () => array.push(3)); expect(await emitter.emit('a')).to.be.true; expect(array).to.have.ordered.members([1, 2, 3]); });
it('.flush()', async function() { const promise = this.polly.flush(); expect(promise).to.be.a('promise'); await promise; });
it('should have access to context as saveAll argument', async () => { Parse.Cloud.beforeSave('TestObject', (req) => { expect(req.context.a).toEqual('a'); }); Parse.Cloud.afterSave('TestObject', (req) => { expect(req.context.a).toEqual('a'); }); const obj1 = new TestObject(); const obj2 = new TestObject(); await Parse.Object.saveAll([obj1, obj2], { context: { a: 'a' }}); });
gpu.createKernel(function(v) { const pixel = v[this.thread.y][this.thread.x]; this.color(255, 255, 255, pixel.a / 255); }, { output: [width, height], graphical: true, argumentTypes: { v: 'Array2D(4)' } })
lab.test('it calls ApiActions.get from getDetails', (done) => { stub.ApiActions.get.mock = function (url, data, store, typeReq, typeRes, callback) { Code.expect(url).to.be.a.string(); Code.expect(data).to.be.undefined(); Code.expect(store).to.be.an.object(); Code.expect(typeReq).to.be.an.instanceof(FluxConstant); Code.expect(typeRes).to.be.an.instanceof(FluxConstant); Code.expect(callback).to.not.exist(); done(); }; Actions.getDetails(); });
describe('Unit | Adapter', function() { it('should exist', function() { expect(Adapter).to.be.a('function'); }); });