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'); });
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('getFunction should ok', async function () { const func = await client.getFunction(serviceName, functionName, {}, 'LATEST'); expect(func.data).to.have.property('functionName', functionName); const initFunc = await client.getFunction(serviceName, initFunctionName); expect(initFunc.data).to.have.property('functionName', initFunctionName); });
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('createQueue should ok', async function() { const response = await client.createQueue(queueName); expect(response).to.be.ok(); expect(response.code >= 200 && response.code < 300).to.be.ok(); expect(response.headers).to.have.property('location', `http://${ACCOUNT_ID}.mns.cn-shanghai.aliyuncs.com/queues/test-queue`); });
it('listCustomDomains should be ok', async function () { const response = await client.listCustomDomains(); expect(response.data).to.be.ok(); expect(response.data.customDomains).to.be.ok(); expect(response.data.customDomains.length).to.above(0); const [customDomain] = response.data.customDomains; expect(customDomain).to.have.property('domainName'); });
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('getService should ok', async function () { var service = await client.getService(serviceName, {}, 'LATEST'); expect(service.data).to.be.ok(); expect(service.data).to.have.property('serviceName', serviceName); expect(service.data).to.have.property('description', ''); service = await client.getService(serviceName); expect(service.data).to.be.ok(); expect(service.data).to.have.property('serviceName', serviceName); expect(service.data).to.have.property('description', ''); });
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); });
before(async function () { const service = await client.createService(tagServiceName); expect(service.data).to.be.ok(); expect(service.data).to.have.property('serviceName', tagServiceName); });
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('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('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'); });