Skip to content

Commit

Permalink
Merge branch 'main' into kathy_bulk_send
Browse files Browse the repository at this point in the history
  • Loading branch information
crayolakat committed Sep 22, 2023
2 parents 0469048 + 19c5eea commit a0cd0d5
Show file tree
Hide file tree
Showing 53 changed files with 6,078 additions and 6,953 deletions.
8 changes: 4 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"presets": ["react", "env", "stage-0"],
"only": ["*.js", "*.jsx"],
"presets": ["@babel/preset-react", "@babel/preset-env", ["@babel/preset-typescript", { "allExtensions": true, "isTSX": true }]],
"only": ["./**/*.js", "./**/*.jsx"],
"plugins": [
["transform-runtime", {
"polyfill": false,
"@babel/plugin-proposal-export-default-from",
["@babel/plugin-transform-runtime", {
"regenerator": true
}]
],
Expand Down
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ DST_REFERENCE_TIMEZONE='US/Eastern'
PASSPORT_STRATEGY=local
TEXTER_SIDEBOXES=celebration-gif,default-dynamicassignment,default-releasecontacts,contact-reference,tag-contact,freshworks-widget,default-editinitial,take-conversations,hide-media,texter-feedback,contact-notes
OWNER_CONFIGURABLE=ALL
NGP_VAN_API_KEY=
NGP_VAN_APP_NAME=
NGP_VAN_WEBHOOK_BASE_URL=
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["airbnb", "prettier"],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"env": { "jest": true, "node": true, "browser": true, "jasmine": true }
}
6 changes: 3 additions & 3 deletions .github/workflows/cypress-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [12.x]
node-version: [16.x]
services:
redis:
image: redis
Expand All @@ -24,9 +24,9 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cypress run
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v4
env:
DEBUG: '@cypress/github-action'
NODE_ENV: test
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/jest-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [10.x, 11.x, 12.x]
node-version: [14.x, 15.x, 16.x]
services:
redis:
image: redis
Expand All @@ -24,7 +24,7 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -36,7 +36,9 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-yarn-
- run: yarn
- run: yarn test
- env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: yarn test
test-rediscache-contactcache:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -55,7 +57,7 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -67,7 +69,9 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test-rediscache-contactcache
- env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: yarn test-rediscache-contactcache
test-rediscache:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -86,7 +90,7 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -98,7 +102,9 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test-rediscache
- env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: yarn test-rediscache
test-sqlite:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -108,7 +114,7 @@ jobs:
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -120,4 +126,6 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test-sqlite
- env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: yarn test-sqlite
9 changes: 9 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
PATH="/usr/local/bin:$PATH"
if [ -f $HOME/.nvm/nvm.sh ]
then
. $HOME/.nvm/nvm.sh
PATH="$HOME/.nvm/versions/node/v16.18.0/bin:$PATH"
fi

yarn lint-staged
Empty file added .keep
Empty file.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
16.18.0
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILDER_IMAGE=node:12.22
ARG RUNTIME_IMAGE=node:12.22-alpine
ARG BUILDER_IMAGE=node:16.18
ARG RUNTIME_IMAGE=node:16.18-alpine
ARG PHONE_NUMBER_COUNTRY=US

FROM ${BUILDER_IMAGE} as builder
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Spoke is an open source text-distribution tool for organizations to mobilize sup

Spoke was created by Saikat Chakrabarti and Sheena Pakanati, and is now maintained by MoveOn.org.

The latest version is [12.3](https://github.com/MoveOnOrg/Spoke/tree/12.3.0) (see [release notes](https://github.com/MoveOnOrg/Spoke/blob/main/docs/RELEASE_NOTES.md#v123))
The latest version is [13.0.1](https://github.com/MoveOnOrg/Spoke/tree/13.0.1) (see [release notes](https://github.com/MoveOnOrg/Spoke/blob/main/docs/RELEASE_NOTES.md#v1301))


## Setting up Spoke
Expand All @@ -24,7 +24,7 @@ Want to know more?
### Quick Start with Heroku
This version of Spoke suitable for testing and, potentially, for small campaigns. This won't cost any money and will not support production(aka large-scale) usage. It's a great way to practice deploying Spoke or see it in action.

<a href="https://heroku.com/deploy?template=https://github.com/MoveOnOrg/Spoke/tree/12.3.0">
<a href="https://heroku.com/deploy?template=https://github.com/MoveOnOrg/Spoke/tree/13.0.1">

<img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy">
</a>
Expand Down
15 changes: 12 additions & 3 deletions __test__/backend.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isSqlite } from "../src/server/models/";
import { resolvers } from "../src/server/api/schema";
import { schema } from "../src/api/schema";
import { assignmentRequiredOrAdminRole } from "../src/server/api/errors";
Expand Down Expand Up @@ -175,7 +176,7 @@ async function createCampaign(user, title, description, organizationId) {

// graphQL tests

describe("graphql test suite", async () => {
describe("graphql test suite", () => {
beforeAll(
async () => await setupTest(),
global.DATABASE_SETUP_TEARDOWN_TIMEOUT
Expand Down Expand Up @@ -352,7 +353,7 @@ describe("graphql test suite", async () => {
}).save();
});

describe("contacts", async () => {
describe("contacts", () => {
let campaigns;
let contacts;
beforeEach(async () => {
Expand Down Expand Up @@ -621,7 +622,15 @@ describe("graphql test suite", async () => {
let parsedDate = new Date(copiedCampaign.due_by);
expect(parsedDate).toEqual(campaign.due_by);
} else {
expect(copiedCampaign.due_by).toEqual(campaign.due_by);
if (isSqlite) {
// Currently an open issue w/ datetime being stored as a string in SQLite3 for Jest tests: https://github.com/TryGhost/node-sqlite3/issues/1355. This results in milliseconds being truncated when getting campaign due_by
const campaignDueBy = campaign.due_by;

campaignDueBy.setMilliseconds(0);
expect(copiedCampaign.due_by).toEqual(campaignDueBy);
} else {
expect(copiedCampaign.due_by).toEqual(campaign.due_by);
}
}
if (
typeof copiedCampaign.features === "object" &&
Expand Down
8 changes: 5 additions & 3 deletions __test__/components/AssignmentSummary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ function getAssignment({ isDynamic = false, counts = {} }) {
}

describe("AssignmentSummary text", function t() {
let summary;

beforeEach(() => {
this.summary = mount(
summary = mount(
<AssignmentSummary
muiTheme={muiTheme}
assignment={getAssignment({
Expand All @@ -67,10 +69,10 @@ describe("AssignmentSummary text", function t() {
(notInUSA, allowSendAll) => {
window.NOT_IN_USA = notInUSA;
window.ALLOW_SEND_ALL = allowSendAll;
const title = this.summary.find(CardHeader);
const title = summary.find(CardHeader);
expect(title.prop("title")).toBe("New Campaign");

const htmlWrapper = this.summary.findWhere(
const htmlWrapper = summary.findWhere(
d => d.length && d.type() === "div" && d.prop("dangerouslySetInnerHTML")
);
expect(htmlWrapper.prop("dangerouslySetInnerHTML")).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function genComponent(assignment, propertyOverrides = {}) {
return wrapper;
}

describe("ContactController process flows", async () => {
describe("ContactController process flows", () => {
it("Normal nondynamic assignment queue", async () => {
const assignment = genAssignment(
false,
Expand Down
Loading

0 comments on commit a0cd0d5

Please sign in to comment.