Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"node": "20.16.0",
"yarn": ">=1.19.1"
},
"packageManager": "yarn@1.19.1",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows Corepack to pick up the correct version of Yarn to be used for local development.

"resolutions": {
"**/@types/express": "^4.17.17",
"**/event-stream": "3.3.4",
Expand All @@ -124,15 +125,15 @@
"devDependencies": {
"@types/chai": "^4.2.12",
"@types/chai-as-promised": "^7.1.3",
"@types/chai-http": "^3.0.5",
"@types/chai-http": "^4.2.0",
"@types/concat-stream": "^1.6.0",
"@types/mocha": "^8.0.2",
"@types/sinon": "^5.0.7",
"@types/sinon-chai": "^2.7.37",
"@types/sinon-express-mock": "^1.3.9",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-http": "chaijs/chai-http",
"chai-http": "^4.3.0",
Comment thread
mnvsngv marked this conversation as resolved.
"concat-stream": "^1.6.2",
"depcheck": "^0.6.11",
"mocha": "^8.1.1",
Expand Down
30 changes: 17 additions & 13 deletions src/actions/marketo/test_marketo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,23 @@ import { MarketoTransaction } from "./marketo_transaction"
listRemoveLeadsFromList: spies[3],
}

sinon.stub(MarketoTransaction.prototype, "marketoClientFromRequest").callsFake(() => {
return {
lead: {
createOrUpdate: spy.leadCreateOrUpdate,
},
campaign: {
request: spy.campaignRequest,
},
list: {
addLeadsToList: spy.listAddLeadsToList,
removeLeadsFromList: spy.listRemoveLeadsFromList,
},
}
// Wrap stubbing in before() to ensure it is created after any global sinon.restore()
// calls from previous test files (like test_server.ts) have run.
before(() => {
sinon.stub(MarketoTransaction.prototype, "marketoClientFromRequest").callsFake(() => {
return {
lead: {
createOrUpdate: spy.leadCreateOrUpdate,
},
campaign: {
request: spy.campaignRequest,
},
list: {
addLeadsToList: spy.listAddLeadsToList,
removeLeadsFromList: spy.listRemoveLeadsFromList,
},
}
})
})

it("sends all the data to Marketo for the legacy request format", () => {
Expand Down
7 changes: 3 additions & 4 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import * as chaiAsPromised from "chai-as-promised"
import * as sinonChai from "sinon-chai"
import * as winston from "winston"

// const chaiHttp = require("chai-http")

// chai.use(chaiHttp)
const chaiHttp = require("chai-http")
chai.use(chaiHttp)
chai.use(sinonChai)
chai.use(chaiAsPromised) // should be last
winston.remove(winston.transports.Console)
Expand All @@ -20,7 +19,7 @@ import "./test_action_response"
import "./test_actions"
import "./test_json_detail_stream"
import "./test_oauth_action"
// import "./test_server"
import "./test_server"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm adding back the test_server tests so that I can add test cases for OAuth in my next PR.

import "./test_smoke"

import "../src/actions/airtable/test_airtable"
Expand Down
10 changes: 10 additions & 0 deletions test/test_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ import * as sinon from "sinon"
import * as apiKey from "../src/server/api_key"
import Server from "../src/server/server"

import "../src/actions/index"

const chaiHttp = require("chai-http")
chai.use(chaiHttp)

describe("the action hub", () => {

// Clear out sinon state after each test to ensure hermeticity
afterEach(() => {
sinon.restore()
})

it("responds to get requests with a nice html page", (done) => {
chai.request(new Server().app)
.get("/")
Expand Down
Loading
Loading