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

Fixed serializer unit tests

This commit is contained in:
Nazar Gargol 2019-11-07 12:27:02 +07:00
parent 640f7155fc
commit 3b792a075a
4 changed files with 10 additions and 10 deletions

View file

@ -12,7 +12,7 @@ describe('Unit: canary/utils/serializers/output/pages', function () {
return Object.assign(data, {toJSON: sinon.stub().returns(data)});
};
sinon.stub(mapper, 'mapPost').returns({});
sinon.stub(mapper, 'mapPage').returns({});
});
afterEach(function () {
@ -46,7 +46,7 @@ describe('Unit: canary/utils/serializers/output/pages', function () {
serializers.output.pages.all(ctrlResponse, apiConfig, frame);
mapper.mapPost.callCount.should.equal(2);
mapper.mapPost.getCall(0).args.should.eql([ctrlResponse.data[0], frame]);
mapper.mapPage.callCount.should.equal(2);
mapper.mapPage.getCall(0).args.should.eql([ctrlResponse.data[0], frame]);
});
});

View file

@ -38,7 +38,7 @@ describe('Unit: canary/utils/serializers/output/posts', function () {
meta: {}
};
serializers.output.pages.all(ctrlResponse, apiConfig, frame);
serializers.output.posts.all(ctrlResponse, apiConfig, frame);
mapper.mapPost.callCount.should.equal(2);
mapper.mapPost.getCall(0).args.should.eql([ctrlResponse.data[0], frame]);

View file

@ -12,7 +12,7 @@ describe('Unit: v3/utils/serializers/output/pages', function () {
return Object.assign(data, {toJSON: sinon.stub().returns(data)});
};
sinon.stub(mapper, 'mapPost').returns({});
sinon.stub(mapper, 'mapPage').returns({});
});
afterEach(function () {
@ -34,11 +34,11 @@ describe('Unit: v3/utils/serializers/output/pages', function () {
data: [
pageModel(testUtils.DataGenerator.forKnex.createPost({
id: 'id1',
page: true
type: 'page'
})),
pageModel(testUtils.DataGenerator.forKnex.createPost({
id: 'id2',
page: true
type: 'page'
}))
],
meta: {}
@ -46,7 +46,7 @@ describe('Unit: v3/utils/serializers/output/pages', function () {
serializers.output.pages.all(ctrlResponse, apiConfig, frame);
mapper.mapPost.callCount.should.equal(2);
mapper.mapPost.getCall(0).args.should.eql([ctrlResponse.data[0], frame]);
mapper.mapPage.callCount.should.equal(2);
mapper.mapPage.getCall(0).args.should.eql([ctrlResponse.data[0], frame]);
});
});

View file

@ -38,7 +38,7 @@ describe('Unit: v3/utils/serializers/output/posts', function () {
meta: {}
};
serializers.output.pages.all(ctrlResponse, apiConfig, frame);
serializers.output.posts.all(ctrlResponse, apiConfig, frame);
mapper.mapPost.callCount.should.equal(2);
mapper.mapPost.getCall(0).args.should.eql([ctrlResponse.data[0], frame]);