0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Fixed test mocks for Url Service test suite

refs 042618fe93

- There's no longer "getValue" method passed around in UrlService, so the were unnecessary and did a wrong thing here :) Yey, less code!
This commit is contained in:
Naz 2021-11-15 20:11:05 +04:00
parent 382d2dbe94
commit 0681953e1f

View file

@ -159,26 +159,14 @@ describe('Unit: services/url/UrlService', function () {
describe('fn: getPermalinkByUrl', function () { describe('fn: getPermalinkByUrl', function () {
it('found', function () { it('found', function () {
const permalinkStub1 = sinon.stub().returns({
getValue: sinon.stub().returns('/:slug/')
});
const permalinkStub2 = sinon.stub().returns({
getValue: sinon.stub().returns('/:primary_tag/')
});
urlService.urlGenerators = [ urlService.urlGenerators = [
{ {
uid: 0, uid: 0,
router: { permalink: '/:slug/'
getPermalinks: permalinkStub1
}
}, },
{ {
uid: 1, uid: 1,
router: { permalink: '/:primary_tag/'
getPermalinks: permalinkStub2
}
} }
]; ];
@ -189,26 +177,14 @@ describe('Unit: services/url/UrlService', function () {
}); });
it('found', function () { it('found', function () {
const permalinkStub1 = sinon.stub().returns({
getValue: sinon.stub().returns('/:slug/')
});
const permalinkStub2 = sinon.stub().returns({
getValue: sinon.stub().returns('/:primary_tag/')
});
urlService.urlGenerators = [ urlService.urlGenerators = [
{ {
uid: 0, uid: 0,
router: { permalink: '/:slug/'
getPermalinks: permalinkStub1
}
}, },
{ {
uid: 1, uid: 1,
router: { permalink: '/:primary_tag/'
getPermalinks: permalinkStub2
}
} }
]; ];