Skip to content

Commit

Permalink
Add test case for string with uppercase letters
Browse files Browse the repository at this point in the history
  • Loading branch information
mrm8488 committed Apr 26, 2018
1 parent 1006482 commit 315f48b
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 141 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const hexadecimalValues = [
"f"
];

// Set with hexadecimal values (Set is ES new Feature)
// Set with hexadecimal values (Set is an ES6 new Feature)
const hexValuesSet = new Set(hexadecimalValues);

/**
Expand Down
184 changes: 50 additions & 134 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"name": "isMongoObjectID",
"version": "0.0.1",
"description":
"Super fast function to check if a String is a MongoDB ObjectID based on ES6 Sets.",
"description": "Super fast function to check if a String is a MongoDB ObjectID based on ES6 Sets.",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/mocha --reporter spec",
"cover":
"node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha -- -R spec test/*"
"cover": "node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha -- -R spec test/*"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mrm8488/isMongoObjectID"
},
"keywords": ["objectid", "mongodb", "mongodbobjectid"],
"keywords": [
"objectid",
"mongodb",
"mongodbobjectid"
],
"author": "Manuel Romero",
"license": "MIT",
"bugs": {
Expand Down
7 changes: 6 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ describe("Function isValidObjectID - check if a String has MongoDB's ObjectID fo
expect(isValidObjectID("507f191e810c19729de860ek")).to.be.false;
done();
});

it("should return false because of String passed to the function contains uppercase chars ", done => {
expect(isValidObjectID("507f191e810c19729De860e1")).to.be.false;
done();
});
});

describe("vaiid ObjectID format", () => {
describe("valid ObjectID format", () => {
it("should return false because of no param passed to the function", done => {
expect(isValidObjectID("507f191e810c19729de860e1")).to.be.true;
done();
Expand Down

0 comments on commit 315f48b

Please sign in to comment.