Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('renders the header properly', t => {
const router = {
isActive: sinon.stub().returns(true),
};
const wrapper = shallow(
<header> {}} intl={intlProp} toggleAddPost={() => {}} />,
{
context: {
router,
intl,
},
}
);
t.truthy(wrapper.find('Link').first().containsMatchingElement());
t.is(wrapper.find('a').length, 1);
});
</header>
describe('EnsBidContainer.vue', () => {
let localVue, i18n, wrapper, store;
const checkDomain = sinon.stub();
const generateKeyPhrase = sinon.stub();
const startAuctionAndBid = sinon.stub();
const revealBid = sinon.stub();
const sendBid = sinon.stub();
const domainName = 'domainName';
const mockRoute = {
fullPath: 'auction'
};
const mockRouter = {
replace: sinon.stub(),
history: {
current: {
path: '/interface/dapps/register-domain'
}
}
};
beforeEach(function () {
status = sinon.stub(response, 'status')
render = sinon.stub(response, 'render')
next = sinon.spy()
nock.cleanAll()
})
const getGithubClient = () => ({
issues: {
addLabels: sinon.stub(),
removeLabel: sinon.stub(),
createComment: sinon.stub(),
edit: sinon.stub(),
addAssigneesToIssue: sinon.stub(),
getForRepo: sinon.stub(),
create: sinon.stub()
},
projects: {
moveProjectColumn: sinon.stub(),
getProjectCards: sinon.stub(),
createProjectColumn: sinon.stub(),
createProjectCard: sinon.stub(),
deleteProjectCard: sinon.stub(),
moveProjectCard: sinon.stub(),
getRepoProjects: sinon.stub(),
createRepoProject: sinon.stub(),
getProjectColumns: sinon.stub()
},
hasNextPage: sinon.stub(),
getNextPage: sinon.stub()
});
beforeEach(function () {
urlPathValidatorStub = sinon.stub()
newClaimStub = sinon.stub()
insertNewClaimStub = sinon.stub()
visitorPrisonerCheckStub = sinon.stub()
insertRepeatDuplicateClaimStub = sinon.stub()
var route = proxyquire('../../../../../../app/routes/apply/eligibility/new-claim/journey-information', {
'../../../../services/validators/url-path-validator': urlPathValidatorStub,
'../../../../services/data/visitor-prisoner-check': visitorPrisonerCheckStub,
'../../../../services/domain/new-claim': newClaimStub,
'../../../../services/data/insert-new-claim': insertNewClaimStub,
'../../../../services/data/insert-repeat-duplicate-claim': insertRepeatDuplicateClaimStub
})
app = routeHelper.buildApp(route)
})
beforeEach(function () {
sync = sinon.stub().returns(response);
promise = sinon.stub().resolves(response);
});
beforeEach(function () {
this.authServiceMock = mockService(AUTH_SERVICE_ID);
this.commitStub = sinon.stub();
this.dispatchStub = sinon.stub();
this.actionContext = {
commit: this.commitStub,
dispatch: this.dispatchStub
};
});
configObj = {
accountId: 'accountId',
projectId: 'projectId',
revision: '69',
anonymizeIP: true,
botFiltering: true,
};
sinon.stub(projectConfig, 'getEventId');
sinon.stub(projectConfig, 'getVariationIdFromExperimentAndVariationKey');
sinon.stub(projectConfig, 'getExperimentId');
sinon.stub(projectConfig, 'getLayerId');
sinon.stub(projectConfig, 'getAttributeId');
sinon.stub(fns, 'uuid').returns('uuid');
sinon.stub(fns, 'currentTimestamp').returns(100);
});
it('doesn\'t fail if the parent doesn\'t define options', () => {
sinon.stub(Command.prototype, 'options').callsFake(() => { return undefined; });
const options = (command.options() as CommandOption[]);
Utils.restore(Command.prototype.options);
assert(options.length > 0);
});
it('should handle namespace change', fakeAsync(() => {
component['currentFile'] = 'myFile';
let updateFilesStub = sinon.stub(component, 'updateFiles');
let findFileStub = sinon.stub(component, 'findFileIndex').returns(0);
let currentFileStub = sinon.stub(component, 'setCurrentFile');
component['files'] = ['myFile'];
mockFileService.namespaceChanged$ = {
takeWhile: sinon.stub().returns({
subscribe: (callback) => {
let newName = 'bob';
callback(newName);
}
})
};
component.ngOnInit();
tick();