forked from rmosolgo/graphql-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rmosolgo#4328 from rmosolgo/js-fix-typo
JS: fix typo for changeset-version, more logging
- Loading branch information
Showing
7 changed files
with
80 additions
and
25 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
javascript_client/src/__tests__/__snapshots__/syncTest.ts.snap
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
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
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
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 |
---|---|---|
@@ -1,14 +1,25 @@ | ||
jest.dontMock('nock'); | ||
import nock from "nock" | ||
import Logger from "../logger"; | ||
import sendPayload from "../sendPayload" | ||
|
||
var fakeLogger = { | ||
log: function() {}, | ||
bright: function(str: string) { return str }, | ||
colorize: function(str: string) { return str }, | ||
red: function(str: string) { return str }, | ||
green: function(str: string) { return str }, | ||
error: function() {}, | ||
isQuiet: true, | ||
} as Logger | ||
|
||
describe("Posting GraphQL to OperationStore Endpoint", () => { | ||
it("Posts to the specified URL", () => { | ||
var mock = nock("http://example.com") | ||
.post("/stored_operations/sync") | ||
.reply(200, { "ok" : "ok" }) | ||
|
||
return sendPayload("payload", { url: "http://example.com/stored_operations/sync" }).then(function() { | ||
return sendPayload("payload", { url: "http://example.com/stored_operations/sync", logger: fakeLogger }).then(function() { | ||
expect(mock.isDone()).toEqual(true) | ||
}) | ||
}) | ||
|
@@ -18,7 +29,7 @@ describe("Posting GraphQL to OperationStore Endpoint", () => { | |
.post("/stored_operations/sync") | ||
.reply(200, { "ok" : "ok" }) | ||
|
||
return sendPayload("payload", { url: "https://example2.com/stored_operations/sync" }).then(function() { | ||
return sendPayload("payload", { url: "https://example2.com/stored_operations/sync", logger: fakeLogger }).then(function() { | ||
expect(mock.isDone()).toEqual(true) | ||
}) | ||
}) | ||
|
@@ -29,7 +40,7 @@ describe("Posting GraphQL to OperationStore Endpoint", () => { | |
.basicAuth({ user: "username", pass: "pass" }) | ||
.reply(200, { "ok" : "ok" }) | ||
|
||
return sendPayload("payload", { url: "https://username:[email protected]:229/stored_operations/sync?q=1" }).then(function() { | ||
return sendPayload("payload", { url: "https://username:[email protected]:229/stored_operations/sync?q=1", logger: fakeLogger }).then(function() { | ||
expect(mock.isDone()).toEqual(true) | ||
}) | ||
}) | ||
|
@@ -39,7 +50,7 @@ describe("Posting GraphQL to OperationStore Endpoint", () => { | |
.post("/stored_operations/sync") | ||
.reply(200, { result: "ok" }) | ||
|
||
return sendPayload("payload", { url: "http://example.com/stored_operations/sync" }).then(function(response) { | ||
return sendPayload("payload", { url: "http://example.com/stored_operations/sync", logger: fakeLogger }).then(function(response) { | ||
expect(response).toEqual('{"result":"ok"}') | ||
}) | ||
}) | ||
|
@@ -54,7 +65,7 @@ describe("Posting GraphQL to OperationStore Endpoint", () => { | |
.post("/stored_operations/sync") | ||
.reply(200, { result: "ok" }) | ||
|
||
return sendPayload("payload", { url: "http://example.com/stored_operations/sync", headers: { thing: "Stuff" }, changesetVersion: "2023-01-01" }).then(function(_response) { | ||
return sendPayload("payload", { url: "http://example.com/stored_operations/sync", logger: fakeLogger, headers: { thing: "Stuff" }, changesetVersion: "2023-01-01" }).then(function(_response) { | ||
expect(mock.isDone()).toEqual(true) | ||
}) | ||
}) | ||
|
@@ -72,7 +83,7 @@ describe("Posting GraphQL to OperationStore Endpoint", () => { | |
.post("/stored_operations/sync") | ||
.reply(200, { result: "ok" }) | ||
|
||
var opts = {secret: key, client: "Abc", url: "http://example.com/stored_operations/sync"} | ||
var opts = {secret: key, client: "Abc", url: "http://example.com/stored_operations/sync", logger: fakeLogger } | ||
return sendPayload(payload, opts).then(function(response) { | ||
expect(response).toEqual('{"result":"ok"}') | ||
expect(mock.isDone()).toEqual(true) | ||
|
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
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