chai-uuid
Chai plugin for performing assertions on UUIDs
Install
$ npm install chai-uuid
Example
Use the uuid
or guid
method to test whether the assertion is a valid UUID.
const chai = ;chai;
Expect
const chai = ;chai;const expect = chaiexpect; // validate UUID v1tobea;// validate UUID v2tobea;// validate UUID v3tobea;// validate UUID v4tobea;// validate UUID v5tobea;// validate UUID (any version)tobea; // optionally, you can use the guid methodtobea;
Should
const chai = ;chai;const should = chai; // validate UUID v1'bd74c8da-4d9e-11e7-b114-b2f933d5fe66'shouldbea; // validate GUID'bd74c8da-4d9e-11e7-b114-b2f933d5fe66'shouldbea;
Assert
const chai = ;chai;const assert = chaiassert; // validate UUID v1assert; // validate GUIDassert;