简体   繁体   中英

How can I unit test my Active Directory queries?

I have small functions, which defines the AD connection and a function which creates all queries to find user information.

How can I test functions like this with chai/mocha?

Active Directory uses LDAP protocol for querying. So tou can use an LDAP mock server that starts at the start of the required testing section. There is a npm package for LDAP mock server that reads the its data from json files: https://github.com/veo-labs/ldap-server-mock

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM