it('updateService should ok', async function () { const service = await client.updateService(serviceName, { description: 'this is test update service' }); expect(service.data).to.be.ok(); expect(service.data).to.have.property('serviceName', serviceName); expect(service.data).to.have.property('description', 'this is test update service'); });
before(async function () { // clean up try { await client.deleteService(serviceName); } catch (ex) { // Ignore } const service = await client.createService(serviceName); expect(service.data).to.be.ok(); expect(service.data).to.have.property('serviceName', serviceName); });
it('promise and await/async', async () => { const rows = await clickhouse.query(sql).toPromise(); expect(rows).to.have.length(rowCount); expect(rows[0]).to.eql({ number: 0, str: '0', date: '1970-01-02' }); });
it('publishMessage should ok', async function() { const response = await client.publishMessage(topicName, { MessageBody: 'test message' }); expect(response).to.be.ok(); expect(response.code).to.be(201); const message = response.body; expect(message).to.have.property('MessageId'); expect(message).to.have.property('MessageBodyMD5'); });
it('getFunctionCode should ok', async function () { var code = await client.getFunctionCode(serviceName, functionName); expect(code.data).to.have.property('url'); expect(code.data).to.have.property('checksum'); code = await client.getFunctionCode(serviceName, functionName, {}, 'LATEST'); expect(code.data).to.have.property('url'); expect(code.data).to.have.property('checksum'); });
it('listServices should ok', async function () { const response = await client.listServices(); expect(response.data).to.be.ok(); expect(response.data.services).to.be.ok(); expect(response.data.services.length).to.above(0); const [service] = response.data.services; expect(service).to.have.property('serviceName'); });
it('callback #2', callback => { clickhouse.query(sql, (err, rows) => { expect(err).to.not.be.ok(); expect(rows).to.have.length(rowCount); expect(rows[0]).to.eql({ number: 0, str: '0', date: '1970-01-02' }); callback(); }); });
describe('properties', function () { it('should have basePath property', function () { expect(apiClient).to.have.property('basePath'); }); it('should have basePath property', function () { expect(apiClient).to.have.property('defaultHeaders'); }); it('should have basePath property', function () { expect(apiClient).to.have.property('timeout'); }); });
it('getTopicAttributes should ok', async function() { const response = await client.getTopicAttributes(topicName); expect(response).to.be.ok(); expect(response.code).to.be(200); const topic = response.body; expect(topic).to.have.property('TopicName', topicName); });
it('createCustomDomain should be ok', async function () { const customDomain = await client.createCustomDomain(domainName); expect(customDomain.data).to.be.ok(); expect(customDomain.data).to.have.property('domainName', domainName); });
it('sendMessage should ok', async function() { const response = await client.sendMessage(queueName, { MessageBody: 'just test it' }); expect(response).to.be.ok(); expect(response.code).to.be(201); const body = response.body; expect(body).to.have.property('MessageId'); expect(body).to.have.property('MessageBodyMD5'); });
it('createService should ok', async function () { const service = await client.createService(serviceName); expect(service.data).to.be.ok(); expect(service.data).to.have.property('serviceName', serviceName); });
it('publishMessage should ok', async function() { const response = await producer.publishMessage('test message'); expect(response).to.be.ok(); expect(response.code).to.be(201); const message = response.body; expect(message).to.have.property('MessageId'); expect(message).to.have.property('MessageBodyMD5'); });