DefinitelyTyped/types/sasl-plain/sasl-plain-tests.ts
2018-12-05 08:49:34 +01:00

24 lines
594 B
TypeScript

import PlainMechanism = require('sasl-plain');
import { Mechanism } from 'sasl-plain';
import { Factory } from 'saslmechanisms';
new Factory().use(PlainMechanism);
new Factory().use(Mechanism);
// $ExpectType "PLAIN"
PlainMechanism.prototype.name;
// $ExpectType true
PlainMechanism.prototype.clientFirst;
const m = new PlainMechanism();
// $ExpectType "PLAIN"
m.name;
// $ExpectType true
m.clientFirst;
// $ExpectType string
m.response({ username: 'u', password: 'pw' });
m.response({ username: 'u', password: 'pw', authzid: 'a' });
// $ExpectType PlainMechanism
m.challenge('challenge');