it("should generate an anon id oitherwise", function() { let mx = sinon.spy(); sinon.stub(uuid, "v4", () => "gen-anon-id"); assert.deepEqual(mixpanelHelpers(mx).genAnonId({ session: {}, }), "gen-anon-id"); assert.equal(mx.callCount, 0); assert(uuid.v4.calledOnce); assert(uuid.v4.calledWith()); uuid.v4.restore(); });
.end((err, res) => { UUID.v4.restore() if (err) { callback(err) } else { callback(null, res.body) } })
.end((err, res) => { expect(res.body).to.deep.equal({ uuid: IDS.david.uuid, username: '******', isFirstUser: false, isAdmin: false, avatar: null, global: null, disabled: false }) UUID.v4.restore() done() })
it("should accept custom cid format when strictCidFormat is false", function () { var options = { tid: "UA-XXXXX-XX", cid: "custom-format-cid", strictCidFormat: false }; var next = sinon.spy(uuid, 'v4') var visitor = ua(options); next.called.should.equal(false, "next() should't be called") uuid.v4.restore() visitor.cid.should.equal(options.cid) });
it("should generate new cid (UUID) if provided one is in wrong format", function () { var options = { tid: "UA-XXXXX-XX", cid: "custom-format-cid" }; var next = sinon.spy(uuid, 'v4') var visitor = ua(options); next.calledOnce.should.equal(true, "next() should've been called once") var generatedCid = next.returnValues[0] uuid.v4.restore() visitor.cid.should.not.equal(options.cid) visitor.cid.should.equal(generatedCid) });
.end((err, res) => { UUID.v4.restore() if (err) return done(err) request(app) .get(`/drives/${IDS.publicDrive1.uuid}`) .set('Authorization', 'JWT ' + token) .expect(200) .end((err, res) => { if (err) return done(err) expect(res.body).to.deep.equal({ uuid: IDS.publicDrive1.uuid, type: 'public', writelist: [IDS.alice.uuid], readlist: [], label: 'foobar' }) done() }) })
afterEach(() => { uuidGenerator.v4.restore(); });
afterEach(function() { clock.restore(); uuid.v4.restore(); });
afterEach(() => UUID.v4.restore())
afterEach(() => { spark.internal.board.realtime.boardBindings = []; uuid.v4.restore(); spark.internal.encryption.encryptText.reset(); });
afterEach(() => { uuid.v4.restore(); spark.internal.encryption.encryptText.reset(); });
getUUID: function(ids) { if (isArray(ids)) { return Promise.all(ids.map(uuid.v4.bind(uuid))); } return Promise.resolve(uuid.v4()); }
afterEach(() => { User.findOne.restore(); uuid.v4.restore(); });