Skip to content

Commit

Permalink
fix: Test transport layers back to using string, not json
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed Jun 18, 2024
1 parent 8ecb0df commit e2e57bf
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function send(message) {
const json = JSON.parse(message)
// handle bulk sends
if (Array.isArray(json)) {
json.forEach(send)
json.forEach(json => send(JSON.stringify(json)))
return
}

Expand Down
4 changes: 2 additions & 2 deletions test/TransportHarness.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
id: id,
result: result
}
receiver && receiver(response)
receiver && receiver(JSON.stringify(response))
},
request: function(json) {
receiver && receiver(json)
receiver && receiver(JSON.stringify(json))
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/suite/properties-context.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ let bothContextSentToEvent = false

beforeAll( () => {

transport.onSend(json => {
transport.onSend(message => {
const json = JSON.parse(message)
console.dir(json)
if (json.method === 'Advanced.propertyWithContext') {
if (json.params.appId === 'some-app') {
Expand Down
3 changes: 2 additions & 1 deletion test/suite/properties.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ let propertySetterWasTriggeredWithValue = false

beforeAll( () => {

transport.onSend(json => {
transport.onSend(message => {
const json = JSON.parse(message)
if (json.method === 'Simple.property') {
transport.response(json.id, {
foo: "here's foo"
Expand Down
3 changes: 2 additions & 1 deletion test/suite/provider-errors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ beforeAll( () => {
}
}

transport.onSend(json => {
transport.onSend(message => {
const json = JSON.parse(message)
if (json.method) {
if (json.method === 'Provider.provideSimple') {
providerMethodNotificationRegistered = true
Expand Down
3 changes: 2 additions & 1 deletion test/suite/provider.as-class.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ beforeAll( () => {
}
}

transport.onSend(json => {
transport.onSend(message => {
const json = JSON.parse(message)
if (json.method) {
if (json.method === 'Provider.provideSimple') {
providerMethodNotificationRegistered = true
Expand Down
3 changes: 2 additions & 1 deletion test/suite/provider.as-object.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ beforeAll( () => {
}


transport.onSend(json => {
transport.onSend(message => {
const json = JSON.parse(message)
if (json.method) {
if (json.method === 'Provider.provideSimple') {
providerMethodNotificationRegistered = true
Expand Down
3 changes: 2 additions & 1 deletion test/suite/provider.with-multiple-methods.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ beforeAll( () => {
}
}

transport.onSend(json => {
transport.onSend(message => {
const json = JSON.parse(message)
if (json.method) {
if (json.method === 'Provider.provideMultipleMethods') {
providerMethodOneNotificationRegistered = true
Expand Down
3 changes: 2 additions & 1 deletion test/suite/provider.with-no-response.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ beforeAll( () => {
}
}

transport.onSend(json => {
transport.onSend(message => {
const json = JSON.parse(message)
if (json.method) {
if (json.method === 'Provider.provideNoResponseMethod') {
providerMethodNotificationRegistered = true
Expand Down

0 comments on commit e2e57bf

Please sign in to comment.