-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add checkMongoexportInstalled tests
- Loading branch information
1 parent
6585d45
commit bb0cede
Showing
4 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
test/checkMongoexportInstalled/checkMongoexportInstalled.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { MongoexportNotInstalledError } from '@/errors'; | ||
import { checkMongoexportInstalled } from '@/utils/checkMongoexportInstalled'; | ||
|
||
import { expect } from 'chai'; | ||
import * as sinon from 'sinon'; | ||
import proxyquire from 'proxyquire'; | ||
|
||
export default function (): void { | ||
describe('Test: checkMongoexportInstalled auxiliary function', function () { | ||
it(`Should pass when mongoexport is installed`, function () { | ||
const expected = true; | ||
const fakeChecker = sinon.fake.returns(expected); | ||
const proxyedModule = proxyquire('@/utils/checkMongoexportInstalled', { | ||
'command-exists': { | ||
sync: fakeChecker | ||
} | ||
}); | ||
const mockedCheckMongoexportInstalled: typeof checkMongoexportInstalled = | ||
proxyedModule.checkMongoexportInstalled; | ||
expect(mockedCheckMongoexportInstalled).to.not.throw(); | ||
expect(fakeChecker).to.have.been.calledOnceWithExactly('mongoexport'); | ||
}); | ||
|
||
it(`Should throw a MongoexportNotInstalledError error when mongoexport is not installed`, function () { | ||
const expected = false; | ||
const fakeChecker = sinon.fake.returns(expected); | ||
const proxyedModule = proxyquire('@/utils/checkMongoexportInstalled', { | ||
'command-exists': { | ||
sync: fakeChecker | ||
} | ||
}); | ||
const mockedCheckMongoexportInstalled: typeof checkMongoexportInstalled = | ||
proxyedModule.checkMongoexportInstalled; | ||
expect(mockedCheckMongoexportInstalled).to.throw(MongoexportNotInstalledError); | ||
expect(fakeChecker).to.have.been.calledOnceWithExactly('mongoexport'); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bb0cede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mongoback – ./
mongoback-git-master.euberdeveloper.vercel.app
mongoback.vercel.app
mongoback.euberdeveloper.vercel.app
bb0cede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mongoback-dev – ./
mongoback-dev.vercel.app
mongoback-dev.euberdeveloper.vercel.app
mongoback-dev-git-master.euberdeveloper.vercel.app