diff --git a/src/core/client/stream/test/comments/editComment.spec.tsx b/src/core/client/stream/test/comments/editComment.spec.tsx index f19d4f3f9..c033133b1 100644 --- a/src/core/client/stream/test/comments/editComment.spec.tsx +++ b/src/core/client/stream/test/comments/editComment.spec.tsx @@ -1,3 +1,4 @@ +import sinon from "sinon"; import timekeeper from "timekeeper"; import { timeout } from "talk-common/utils"; @@ -16,14 +17,8 @@ function createTestRenderer() { .withArgs(undefined, { id: assets[0].id, url: null }) .returns(assets[0]) ), - me: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(users[0]) - ), - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), + me: sinon.stub().returns(users[0]), + settings: sinon.stub().returns(settings), }, Mutation: { editComment: createSinonStub( diff --git a/src/core/client/stream/test/comments/loadMore.spec.tsx b/src/core/client/stream/test/comments/loadMore.spec.tsx index ee80d17fd..bcbde1021 100644 --- a/src/core/client/stream/test/comments/loadMore.spec.tsx +++ b/src/core/client/stream/test/comments/loadMore.spec.tsx @@ -66,10 +66,7 @@ beforeEach(() => { ) .returns(assetStub) ), - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), + settings: sinon.stub().returns(settings), }, }; diff --git a/src/core/client/stream/test/comments/permalinkView.spec.tsx b/src/core/client/stream/test/comments/permalinkView.spec.tsx index 61c211199..2e0ee1225 100644 --- a/src/core/client/stream/test/comments/permalinkView.spec.tsx +++ b/src/core/client/stream/test/comments/permalinkView.spec.tsx @@ -41,10 +41,7 @@ beforeEach(() => { .withArgs(undefined, { id: assetStub.id, url: null }) .returns(assetStub) ), - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), + settings: sinon.stub().returns(settings), }, }; diff --git a/src/core/client/stream/test/comments/permalinkViewAssetNotFound.spec.tsx b/src/core/client/stream/test/comments/permalinkViewAssetNotFound.spec.tsx index a5ff91b34..6283ebd59 100644 --- a/src/core/client/stream/test/comments/permalinkViewAssetNotFound.spec.tsx +++ b/src/core/client/stream/test/comments/permalinkViewAssetNotFound.spec.tsx @@ -1,4 +1,5 @@ import { ReactTestRenderer } from "react-test-renderer"; +import sinon from "sinon"; import { timeout } from "talk-common/utils"; import { createSinonStub } from "talk-framework/testHelpers"; @@ -12,10 +13,7 @@ beforeEach(() => { Query: { comment: () => null, asset: () => null, - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), + settings: sinon.stub().returns(settings), }, }; diff --git a/src/core/client/stream/test/comments/permalinkViewCommentNotFound.spec.tsx b/src/core/client/stream/test/comments/permalinkViewCommentNotFound.spec.tsx index abb24e1a2..c2ffbd425 100644 --- a/src/core/client/stream/test/comments/permalinkViewCommentNotFound.spec.tsx +++ b/src/core/client/stream/test/comments/permalinkViewCommentNotFound.spec.tsx @@ -38,10 +38,7 @@ beforeEach(() => { .withArgs(undefined, { id: assetStub.id, url: null }) .returns(assetStub) ), - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), + settings: sinon.stub().returns(settings), }, }; diff --git a/src/core/client/stream/test/comments/postComment.spec.tsx b/src/core/client/stream/test/comments/postComment.spec.tsx index 6da257f02..f4594c4dd 100644 --- a/src/core/client/stream/test/comments/postComment.spec.tsx +++ b/src/core/client/stream/test/comments/postComment.spec.tsx @@ -1,4 +1,5 @@ import { ReactTestRenderer } from "react-test-renderer"; +import sinon from "sinon"; import timekeeper from "timekeeper"; import { timeout } from "talk-common/utils"; @@ -11,11 +12,14 @@ let testRenderer: ReactTestRenderer; beforeEach(() => { const resolvers = { Query: { - asset: createSinonStub(s => s.throws(), s => s.returns(assets[0])), - me: createSinonStub(s => s.throws(), s => s.returns(users[0])), - settings: createSinonStub( + settings: sinon.stub().returns(settings), + me: sinon.stub().returns(users[0]), + asset: createSinonStub( s => s.throws(), - s => s.withArgs(undefined).returns(settings) + s => + s + .withArgs(undefined, { id: assets[0].id, url: null }) + .returns(assets[0]) ), }, Mutation: { diff --git a/src/core/client/stream/test/comments/postLocalReply.spec.tsx b/src/core/client/stream/test/comments/postLocalReply.spec.tsx index e279b4fd5..ac69ce5ae 100644 --- a/src/core/client/stream/test/comments/postLocalReply.spec.tsx +++ b/src/core/client/stream/test/comments/postLocalReply.spec.tsx @@ -1,4 +1,5 @@ import { ReactTestRenderer } from "react-test-renderer"; +import sinon from "sinon"; import timekeeper from "timekeeper"; import { timeout } from "talk-common/utils"; @@ -11,12 +12,15 @@ let testRenderer: ReactTestRenderer; beforeEach(() => { const resolvers = { Query: { + settings: sinon.stub().returns(settings), + me: sinon.stub().returns(users[0]), asset: createSinonStub( s => s.throws(), - s => s.returns(assetWithDeepestReplies) + s => + s + .withArgs(undefined, { id: assetWithDeepestReplies.id, url: null }) + .returns(assetWithDeepestReplies) ), - me: createSinonStub(s => s.throws(), s => s.returns(users[0])), - settings: createSinonStub(s => s.returns(settings)), }, Mutation: { createComment: createSinonStub( diff --git a/src/core/client/stream/test/comments/postReply.spec.tsx b/src/core/client/stream/test/comments/postReply.spec.tsx index 49da4a3fb..ad96fe03c 100644 --- a/src/core/client/stream/test/comments/postReply.spec.tsx +++ b/src/core/client/stream/test/comments/postReply.spec.tsx @@ -1,4 +1,5 @@ import { ReactTestRenderer } from "react-test-renderer"; +import sinon from "sinon"; import timekeeper from "timekeeper"; import { timeout } from "talk-common/utils"; @@ -11,11 +12,14 @@ let testRenderer: ReactTestRenderer; beforeEach(() => { const resolvers = { Query: { - asset: createSinonStub(s => s.throws(), s => s.returns(assets[0])), - me: createSinonStub(s => s.throws(), s => s.returns(users[0])), - settings: createSinonStub( + settings: sinon.stub().returns(settings), + me: sinon.stub().returns(users[0]), + asset: createSinonStub( s => s.throws(), - s => s.withArgs(undefined).returns(settings) + s => + s + .withArgs(undefined, { id: assets[0].id, url: null }) + .returns(assets[0]) ), }, Mutation: { diff --git a/src/core/client/stream/test/comments/renderReplies.spec.tsx b/src/core/client/stream/test/comments/renderReplies.spec.tsx index d1c5301c9..abf029955 100644 --- a/src/core/client/stream/test/comments/renderReplies.spec.tsx +++ b/src/core/client/stream/test/comments/renderReplies.spec.tsx @@ -1,4 +1,5 @@ import { ReactTestRenderer } from "react-test-renderer"; +import sinon from "sinon"; import { timeout } from "talk-common/utils"; import { createSinonStub } from "talk-framework/testHelpers"; @@ -17,10 +18,7 @@ beforeEach(() => { .withArgs(undefined, { id: assetWithDeepReplies.id, url: null }) .returns(assetWithDeepReplies) ), - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), + settings: sinon.stub().returns(settings), }, }; diff --git a/src/core/client/stream/test/comments/renderStream.spec.tsx b/src/core/client/stream/test/comments/renderStream.spec.tsx index 7fd042047..301fc57dd 100644 --- a/src/core/client/stream/test/comments/renderStream.spec.tsx +++ b/src/core/client/stream/test/comments/renderStream.spec.tsx @@ -1,4 +1,5 @@ import { ReactTestRenderer } from "react-test-renderer"; +import sinon from "sinon"; import { timeout } from "talk-common/utils"; import { createSinonStub } from "talk-framework/testHelpers"; @@ -17,10 +18,7 @@ beforeEach(() => { .withArgs(undefined, { id: assets[0].id, url: null }) .returns(assets[0]) ), - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), + settings: sinon.stub().returns(settings), }, }; diff --git a/src/core/client/stream/test/comments/showAllReplies.spec.tsx b/src/core/client/stream/test/comments/showAllReplies.spec.tsx index df08c0b55..b5122028d 100644 --- a/src/core/client/stream/test/comments/showAllReplies.spec.tsx +++ b/src/core/client/stream/test/comments/showAllReplies.spec.tsx @@ -65,6 +65,7 @@ beforeEach(() => { const resolvers = { Query: { + settings: sinon.stub().returns(settings), comment: createSinonStub( s => s.throws(), s => s.withArgs(undefined, { id: commentStub.id }).returns(commentStub) @@ -76,10 +77,6 @@ beforeEach(() => { .withArgs(undefined, { id: assetStub.id, url: null }) .returns(assetStub) ), - settings: createSinonStub( - s => s.throws(), - s => s.withArgs(undefined).returns(settings) - ), }, };