Files
DefinitelyTyped/graphite-udp/graphite-udp-tests.ts
Eric Byers 585e114310 Add declarations for module graphite-udp (#14927)
* Adding graphite-udp typings

* Cleaning up linting errors

* Removing the namespacing that is not needed

* Adding missing constructor typing, capitilizing the interface

* Callback is optional
2017-03-09 22:51:45 -08:00

44 lines
850 B
TypeScript

import graphite = require('graphite-udp');
// Test creation of client directly.
let client = new graphite.Client();
client.put('test', 1);
client.add('test', 1);
client.close();
// Create client with helper
let client2 = graphite.createClient();
client2.put('test2', 1);
client2.add('test2', 1);
client2.close();
// Test creation with options.
graphite.createClient({
host: '127.0.0.1',
port: 2003,
type: 'udp4',
maxPacketSize: 4096,
prefix: 'prefix',
suffix: 'suffix',
interval: 60 * 1000,
verbose: true,
callback: (error: Error, metrics: any): void => {
}
});
// Test creation options with class directly.
new graphite.Client({
host: '127.0.0.1',
port: 2003,
type: 'udp4',
maxPacketSize: 4096,
prefix: 'prefix',
suffix: 'suffix',
interval: 60 * 1000,
verbose: true,
callback: (error: Error, metrics: any): void => {
}
});