Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP stage-main-Juneteenth (6.19) -pre #1623

Merged
merged 181 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from 181 commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
85c2ab7
1. add new campaign columns for campaign customization, 2. per-campai…
schuyler1d May 11, 2020
85c2122
Only active survey questions & ativist codes
lperson May 25, 2020
fa7a848
merge stage-main into campaign-jointoken-schemaprep
schuyler1d May 25, 2020
82d91d9
Merge branch 'lp_1512_home_stretch' into lp_ngpvan_action_handler
lperson May 25, 2020
ae9cdf4
serverAdministratorInstructions & validation test
lperson May 25, 2020
692af83
CAMPAIGN_INVITES_CURRENT_USERS_ONLY setting to allow orgs to separate…
schuyler1d May 26, 2020
5af5bf5
texter ui: better accessibility; limit Enter to Ctrl-Enter in sending…
schuyler1d May 26, 2020
116b226
Merge remote-tracking branch 'origin/stage-main' into texterui-access…
schuyler1d May 26, 2020
76fb306
Save full canvassContext with clientChoiceData
lperson May 29, 2020
86587a7
No hardcoded inputType and contactType
lperson May 31, 2020
1ab3fd1
Fix a test
lperson May 31, 2020
00008c7
Merge remote-tracking branch 'origin/main' into campaign-jointoken-sc…
schuyler1d Jun 1, 2020
3290a6d
merge stage-main-61 into campaign-jointoken-schemaprep
schuyler1d Jun 2, 2020
dc8f3fc
move joinOrganization to mutation
schuyler1d Jun 2, 2020
74e72ce
working on tests
lperson Jun 3, 2020
833b694
dynamic assignment joinOrganization link: fix campaignId link
schuyler1d Jun 3, 2020
606f4af
sidebox wip
schuyler1d Jun 3, 2020
6448ca7
Merge remote-tracking branch 'origin/assignmenttexter-refactor-extens…
schuyler1d Jun 3, 2020
2586d69
Merge remote-tracking branch 'origin/texterui-accessibility' into cam…
schuyler1d Jun 3, 2020
a980701
sideboxes wip
schuyler1d Jun 4, 2020
852b069
texter sidebox ui
schuyler1d Jun 4, 2020
5ec9991
texter sidebox: never popover if wide enough for sidebar
schuyler1d Jun 4, 2020
4999251
Merge remote-tracking branch 'origin/stage-main-61' into campaign-joi…
schuyler1d Jun 4, 2020
cbc1c86
Available built out. Tests complete.
lperson Jun 5, 2020
f371459
Merge remote-tracking branch 'moveon/main' into lp_ngpvan_action_handler
lperson Jun 5, 2020
93190db
texter sidebox: campaign.features and saving settings
schuyler1d Jun 5, 2020
66a9a74
add files
schuyler1d Jun 5, 2020
ba07c23
texter updateTags endpoint and sidebox
schuyler1d Jun 6, 2020
738749d
Merge remote-tracking branch 'origin/stage-main-61' into campaign-joi…
schuyler1d Jun 6, 2020
4da81b6
Tag filter UI
lperson Jun 6, 2020
cbbac6c
Send tags filter in ContactsFilter
lperson Jun 6, 2020
34f093c
Filter by tag. Updated schema to return tags
lperson Jun 7, 2020
93277cc
merge stage-main-61 into stage-main-62-wfp
schuyler1d Jun 7, 2020
c2e7b8e
Merge remote-tracking branch 'moveon/stage-main-62-wfp' into lp_tags_…
lperson Jun 7, 2020
a6a7227
ongoing work on message review tags
lperson Jun 7, 2020
9d74d01
Fix canned response import
lperson Jun 7, 2020
5407c7e
Tag filter UI
lperson Jun 6, 2020
4d78c5d
Send tags filter in ContactsFilter
lperson Jun 6, 2020
81c7f7b
Filter by tag. Updated schema to return tags
lperson Jun 7, 2020
96dd819
ongoing work on message review tags
lperson Jun 7, 2020
93018e6
Merge pull request #1592 from lperson/lp_62_fix_script_import
matteosb Jun 7, 2020
3b49ef1
Merge remote-tracking branch 'upstream/stage-main-61' into stage-main…
matteosb Jun 7, 2020
d26f170
Fix admin tags query
matteosb Jun 7, 2020
9f67695
Get tags via the organization
lperson Jun 7, 2020
0987b71
Merge remote-tracking branch 'moveon/stage-main-62-wfp' into lp_tags_…
lperson Jun 7, 2020
5139b9d
fix test on texterUIConfig
schuyler1d Jun 7, 2020
d3d241b
Merge branch 'stage-main-62-wfp' of github.com:MoveOnOrg/Spoke into s…
schuyler1d Jun 7, 2020
83f7dcd
fix test: backend.test.js after moving joinOrganization to different …
schuyler1d Jun 8, 2020
3e4db84
fix tag test
schuyler1d Jun 8, 2020
236906d
fix getFeatures -- make sure org.features is non-empty before trying …
schuyler1d Jun 8, 2020
1a0e248
Logging to troubleshoot missing canned responses
lperson Jun 8, 2020
ceed26c
Merge pull request #1594 from lperson/lp_script_import_diagnostics
lperson Jun 8, 2020
768c8cc
Reload the campaign after importing the script
lperson Jun 8, 2020
c01de81
Merge pull request #1596 from lperson/lp_script_import_diagnostics
lperson Jun 8, 2020
2392da8
Load 🥫 responses into cache after script import
lperson Jun 8, 2020
bb4adba
Merge pull request #1597 from lperson/lp_script_import_diagnostics
lperson Jun 8, 2020
6032659
slightly improved sidebox widgets
schuyler1d Jun 8, 2020
172e034
Merge branch 'stage-main-62-wfp' of github.com:MoveOnOrg/Spoke into s…
schuyler1d Jun 8, 2020
3484057
tags filter is specific so admins will also only see the texter-tags …
schuyler1d Jun 8, 2020
9f3c186
filter tags on client-side by-group
schuyler1d Jun 8, 2020
a842b0e
Merge branch 'lp_tags_in_message_review' of github.com:lperson/Spoke …
lperson Jun 8, 2020
18c6b8b
Merge remote-tracking branch 'moveon/stage-main-62-wfp' into lp_tags_…
lperson Jun 8, 2020
5b588b1
Avoid cost from tags if !EXPERIMENTAL_TAGS
lperson Jun 8, 2020
6a038ea
sidebox organization defaults
schuyler1d Jun 8, 2020
dba40ad
make TEXTER_SIDEBOXES truly optional for now
schuyler1d Jun 8, 2020
6aef054
Merge pull request #1598 from MoveOnOrg/sidebox-orgsettings
schuyler1d Jun 8, 2020
e3d0f95
Merge remote-tracking branch 'origin/stage-main-61' into stage-main-6…
schuyler1d Jun 8, 2020
d31d2a2
Complete: filter and see tags in message review
lperson Jun 8, 2020
0ffe260
Merge remote-tracking branch 'moveon/stage-main-62-wfp' into lp_tags_…
lperson Jun 8, 2020
0726925
Add id to organization query to avoid cache issues
lperson Jun 8, 2020
4d83da1
Merge remote-tracking branch 'origin/stage-main-61' into stage-main-6…
schuyler1d Jun 9, 2020
b9438d5
merge lperson/lp_ngpvan_action_handler into stage-main-62
schuyler1d Jun 9, 2020
53ce925
Add conversation permalink to preview modal
lperson Jun 9, 2020
184c7d8
Make general function to find tag in seletion set
lperson Jun 9, 2020
8c95ac3
Merge pull request #1590 from lperson/lp_tags_in_message_review
lperson Jun 9, 2020
b79138d
Merge remote-tracking branch 'origin/stage-main-62-wfp' into stage-ma…
schuyler1d Jun 9, 2020
879ddcd
Fix import
lperson Jun 9, 2020
48250c2
Merge pull request #1600 from lperson/lp_tags_in_message_review
lperson Jun 9, 2020
fe7d01c
use keyup instead of keydown to avoid button mashing
schuyler1d Jun 9, 2020
a856dab
allow button mashing with config option
schuyler1d Jun 9, 2020
8e4b5a0
Merge remote-tracking branch 'origin/stage-main-62-wfp' into stage-ma…
schuyler1d Jun 9, 2020
0154e7e
Merge remote-tracking branch 'origin/stage-main-62-wfp' into stage-ma…
schuyler1d Jun 9, 2020
c116f0c
Return to request-scoped data loaders
matteosb Jun 9, 2020
d9250d8
Add a logout button for orgless users, fix data loading on login
matteosb Jun 9, 2020
0a36fc4
tag interface and allow any key for needsMessage send
schuyler1d Jun 9, 2020
f82d0c3
Merge branch 'stage-main-62' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 9, 2020
c1e9cda
Remove broken message received notifications
matteosb Jun 9, 2020
71c27d7
Merge remote-tracking branch 'matteosb/request-scoped-loaders' into s…
schuyler1d Jun 9, 2020
55ce833
Merge branch 'stage-main-62' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 9, 2020
ae01a01
remove the rest of the loaders from mutations
schuyler1d Jun 9, 2020
2c0f88c
Merge branch 'stage-main-62' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 9, 2020
22055ed
Merge remote-tracking branch 'matteosb/add-logout-user-home' into sta…
schuyler1d Jun 9, 2020
b22eb50
Merge branch 'stage-main-62' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 9, 2020
619c5c8
Switching to Ctrl-x to send and Ctrl-y to skip
schuyler1d Jun 9, 2020
470d049
Merge branch 'stage-main-62' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 9, 2020
8cbd944
Merge remote-tracking branch 'mateosb/remove-message-received-notific…
schuyler1d Jun 9, 2020
12d7105
allow sideboxes= param on demo page
schuyler1d Jun 10, 2020
23094cc
Merge remote-tracking branch 'origin/stage-main-62' into stage-main-62
schuyler1d Jun 10, 2020
e2fb6c9
bugfix: twilio error contactUpdate should use the transaction, if pre…
schuyler1d Jun 10, 2020
b731cc4
texterui: fix message scrolling which broke with sidebox
schuyler1d Jun 10, 2020
6ea80df
bugfix: campaignId not required
schuyler1d Jun 10, 2020
7a2f654
This was missed when transitioning away from using loaders in mutations
matteosb Jun 10, 2020
d608617
sidebox tag-contact: default language tweak
schuyler1d Jun 10, 2020
268b5dd
Merge remote-tracking branch 'origin/stage-main-62' into stage-main-62
schuyler1d Jun 10, 2020
bef5f98
Merge remote-tracking branch 'matteo/matteosb/fix-editOrganizationRol…
schuyler1d Jun 10, 2020
67db8e7
Merge pull request #1607 from MoveOnOrg/matteosb/fix-editOrganization…
schuyler1d Jun 10, 2020
44bcbe3
tests: throw if editOrganizationFails
schuyler1d Jun 10, 2020
8785feb
Add a csv contact loader backed by S3
matteosb Jun 10, 2020
4b6495d
Merge branch 'stage-main-62' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 10, 2020
6aaef61
consolidate assignmentRequired + assignmentRequiredOrAdminRole, alway…
schuyler1d Jun 11, 2020
bf52838
update assignmentRequiredOrAdminRole documentation
schuyler1d Jun 11, 2020
2523cb8
releaseContacts endpoint and track campaign needsResponseCount
schuyler1d Jun 11, 2020
91ed588
tweak: change query to be numerical ids
schuyler1d Jun 11, 2020
7f40acb
react-router bump and version updates (yarn.lock rebuild)
schuyler1d Jun 11, 2020
c0d0620
version updates remaining from PR #729 (yarn.lock rebuild)
schuyler1d Jun 11, 2020
c61e489
message review: require contact response before exposing the message …
schuyler1d Jun 11, 2020
7efc0ff
message review: allow hover to see whole message with title= attribute
schuyler1d Jun 11, 2020
2866170
Bugfix: allow texters to view/edit their profiles
matteosb Jun 11, 2020
a5c6e69
User menu: route users to admin or texter based on role
matteosb Jun 11, 2020
675b015
Bugfix: show the correct number of available phone numbers
matteosb Jun 12, 2020
6cb8238
Merge pull request #1615 from MoveOnOrg/message-review-convo
lperson Jun 12, 2020
f014387
Fix script import UI feedback
lperson Jun 13, 2020
180e0cd
sideboxes: settingsData in sidebox properties
schuyler1d Jun 13, 2020
d99a733
allow SUPERVOLUNTEER role to do all MessageReview "sudo" tasks
schuyler1d Jun 13, 2020
7125a5c
Code review feedback
lperson Jun 13, 2020
8206a37
MessageReview messageTextFilter
schuyler1d Jun 13, 2020
0e7df27
Merge remote-tracking branch 'origin/stage-main-62' into conversation…
schuyler1d Jun 13, 2020
adfb647
Remove spurious popups on interactions editor
lperson Jun 13, 2020
bf6c08f
MessageReview: add messageTextFilter to bulkReassign
schuyler1d Jun 13, 2020
4d856ee
Merge pull request #1619 from lperson/lp_fix_script_import_ui_feedback
lperson Jun 13, 2020
1270a8d
Merge pull request #1620 from lperson/lp_fix_unwanted_pops_in_script_…
lperson Jun 13, 2020
cfa321e
Merge branch 'permission-checks-consistent' into stage-main-71
schuyler1d Jun 13, 2020
2d229b9
Merge branch 'conversation-messagefilter' into stage-main-71
schuyler1d Jun 13, 2020
c8c7607
Merge remote-tracking branch 'origin/stage-main-62' into stage-main-71
schuyler1d Jun 13, 2020
ecf65a4
Merge remote-tracking branch 'matteosb/matteosb/fix-texter-profile' i…
schuyler1d Jun 13, 2020
8683d58
Merge remote-tracking branch 'origin/matteosb/fix-phone-number-availa…
schuyler1d Jun 13, 2020
e472104
Merge remote-tracking branch 'origin/version-tweaks' into stage-main-71
schuyler1d Jun 13, 2020
5fa326a
Merge remote-tracking branch 'origin/s3-contact-loader' into stage-ma…
schuyler1d Jun 13, 2020
fdb3493
Merge remote-tracking branch 'origin/matteosb/fix-texter-org-switchin…
schuyler1d Jun 13, 2020
828970e
remove console.logs
schuyler1d Jun 13, 2020
02e2ca9
If a contact has no timezone, use campaign's
lperson Jun 13, 2020
7250bd7
Use campaign timezone for texter UI always
lperson Jun 13, 2020
3c92738
Merge remote-tracking branch 'lperson/lp_fix_unwanted_pops_in_script_…
schuyler1d Jun 13, 2020
01e62e5
Merge pull request #1624 from lperson/lp_fix_unwanted_pops_in_script_…
lperson Jun 13, 2020
71b884b
message handler and wip profanity filter
schuyler1d Jun 14, 2020
193669d
merge message-handlers and profanity-tagger into stage-main-71
schuyler1d Jun 14, 2020
ddb83a9
profanity-tagger: default profanity regex
schuyler1d Jun 14, 2020
6e588e1
Merge remote-tracking branch 'origin/profanity-filter' into stage-mai…
schuyler1d Jun 14, 2020
0246812
Fix cacheableData queries in texting hour mutations
matteosb Jun 14, 2020
ad8d508
Use a default timezone moment understands when running on Lambda
matteosb Jun 14, 2020
75e969e
Merge pull request #1627 from MoveOnOrg/matteosb/fix-lambda-tz
schuyler1d Jun 14, 2020
cbb44db
Merge pull request #1626 from matteosb/matteosb/fix-change-texting-ho…
schuyler1d Jun 14, 2020
704e705
MAX_TEXTERS_PER_CAMPAIGN env/org var
schuyler1d Jun 15, 2020
ddff21d
Use DST_REFERENCE_TIMEZONE for campaigns that don't have a timezone
matteosb Jun 15, 2020
c56dfa2
Merge pull request #1630 from MoveOnOrg/matteosb/fix-toolbar-tz-fmt
schuyler1d Jun 15, 2020
7de61ef
Merge branch 'stage-main' into stage-main-71
schuyler1d Jun 15, 2020
11e9d35
Merge remote-tracking branch 'origin/too-many-texters' into stage-mai…
schuyler1d Jun 15, 2020
c6b3488
profanity-tagger: tests and one bugfix: *await* the organization load
schuyler1d Jun 16, 2020
6a4d8ea
Merge remote-tracking branch 'origin/profanity-filter' into stage-mai…
schuyler1d Jun 16, 2020
9362b01
campaign error report (and faster texter stats)
schuyler1d Jun 16, 2020
80adfa7
Merge remote-tracking branch 'origin/error-report' into stage-main-71
schuyler1d Jun 16, 2020
6a2b773
debugging test failures
schuyler1d Jun 16, 2020
27d3bb3
still debugging tests failing
schuyler1d Jun 16, 2020
a9635ad
still debugging tests failing
schuyler1d Jun 16, 2020
90a7ba2
debugging test failures
schuyler1d Jun 16, 2020
5c57c5e
profanity-tagger: suspend texter threshold
schuyler1d Jun 16, 2020
28edf47
Merge branch 'profanity-filter' into stage-main-71
schuyler1d Jun 16, 2020
d1b3f15
Merge branch 'stage-main-71' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 16, 2020
23ca311
merge profanity-filter into stage-main-71
schuyler1d Jun 16, 2020
2c08c76
remove debugging fake failure
schuyler1d Jun 16, 2020
95293e6
Message review: show timestamp of last interaction
matteosb Jun 16, 2020
dfc113a
bugfix: nested form submit submitted to top form, so change to flatbu…
schuyler1d Jun 18, 2020
dd90608
bump up count cache expirations for easier review
schuyler1d Jun 18, 2020
65c4312
profanity-filter: tweak default handler
schuyler1d Jun 18, 2020
d350515
Merge branch 'stage-main-71' of github.com:MoveOnOrg/Spoke into stage…
schuyler1d Jun 18, 2020
81492bc
Get rid of reference error in updateStatus log stmt
matteosb Jun 19, 2020
6307784
release notes for 7.0 (aka 6.19, aka the Juneteenth release!)
schuyler1d Jun 23, 2020
d3eb329
merge 6.1
schuyler1d Jun 23, 2020
edc3bc0
MAX_TEXTERS_PER_CAMPAIGN env var in release notes
schuyler1d Jun 23, 2020
81b61a7
update versions
schuyler1d Jun 23, 2020
c13bc44
Merge pull request #1642 from MoveOnOrg/70-release-notes
schuyler1d Jun 23, 2020
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
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ EMAIL_FROM=
TWILIO_MESSAGE_VALIDITY_PERIOD=
DST_REFERENCE_TIMEZONE='America/New_York'
PASSPORT_STRATEGY=local
SHOW_TAGS=false
EXPERIMENTAL_TAGS=1
TEXTER_SIDEBOXES=contact-reference,tag-contact
31 changes: 31 additions & 0 deletions .github/workflows/jest-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@ jobs:
${{ runner.os }}-${{ matrix.node-version }}-yarn-
- run: yarn
- run: yarn test
test-rediscache-contactcache:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
redis:
image: redis
ports:
- 6379:6379
postgres:
image: postgres:10
env:
POSTGRES_USER: spoke_test
POSTGRES_PASSWORD: spoke_test
POSTGRES_DB: spoke_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test-rediscache-contactcache
test-rediscache:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
60 changes: 3 additions & 57 deletions __test__/backend.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { resolvers } from "../src/server/api/schema";
import { schema } from "../src/api/schema";
import { assignmentRequired } from "../src/server/api/errors";
import { assignmentRequiredOrAdminRole } from "../src/server/api/errors";
import { graphql } from "graphql";

console.log("This is an intentional error");
Expand Down Expand Up @@ -260,34 +260,6 @@ describe("graphql test suite", async () => {
);
});

it("should add texters to a organization", async () => {
testTexterUser = await createUser({
auth0_id: "test456",
first_name: "TestTexterFirst",
last_name: "TestTexterLast",
cell: "555-555-6666",
email: "[email protected]"
});
const joinQuery = `
mutation joinOrganization($organizationUuid: String!) {
joinOrganization(organizationUuid: $organizationUuid) {
id
}
}`;
const variables = {
organizationUuid: testOrganization.data.createOrganization.uuid
};
const context = getContext({ user: testTexterUser });
const result = await graphql(
mySchema,
joinQuery,
rootValue,
context,
variables
);
expect(result.data.joinOrganization.id).toBeTruthy();
});

it("should assign texters to campaign contacts", async () => {
const campaignEditQuery = `
mutation editCampaign($campaignId: String!, $campaign: CampaignInput!) {
Expand Down Expand Up @@ -331,6 +303,8 @@ describe("graphql test suite", async () => {
const context = getContext({ user: testAdminUser });
const updateCampaign = Object.assign({}, testCampaign.data.createCampaign);
const campaignId = updateCampaign.id;
testTexterUser = await helperCreateTexter(testOrganization);

updateCampaign.texters = [
{
id: testTexterUser.id
Expand Down Expand Up @@ -527,34 +501,6 @@ describe("graphql test suite", async () => {
);
expect(results).toEqual(false);
});

test("test assignmentRequired access control", async () => {
const user = await createUser();

const assignment = await new Assignment({
user_id: user.id,
campaign_id: campaign.id
}).save();

const allowUser = await assignmentRequired(
user,
assignment.id,
assignment
);
expect(allowUser).toEqual(true);
const allowUserAssignmentId = await assignmentRequired(
user,
assignment.id
);
expect(allowUserAssignmentId.user_id).toEqual(user.id);
expect(allowUserAssignmentId.id).toEqual(assignment.id);
try {
const notAllowed = await assignmentRequired(user, -1);
throw new Exception("should throw BEFORE this exception");
} catch (err) {
expect(/not authorized/.test(String(err))).toEqual(true);
}
});
});

describe("Copy Campaign", () => {
Expand Down
4 changes: 4 additions & 0 deletions __test__/containers/AssignmentTexterContact.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const campaign = {
textingHoursEnd: 21
},
customFields: [],
texterUIConfig: {
sideboxChoices: [],
options: "{}"
},
interactionSteps: [
{
id: 11,
Expand Down
2 changes: 1 addition & 1 deletion __test__/containers/Tags.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("Tags list with several tags", () => {
// given

const data = {
tags: {
organization: {
tags: [
{
id: "1",
Expand Down
11 changes: 9 additions & 2 deletions __test__/containers/UserMenu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ describe("UserMenu", () => {
id: 1,
displayName: "TestName",
email: "[email protected]",
organizations: [
superVolOrganizations: [
{
id: 2,
name: "testOrg"
}
],
texterOrganizations: [
{
id: 2,
name: "testOrg"
Expand Down Expand Up @@ -46,7 +52,8 @@ describe("UserMenu", () => {
id: 1,
displayName: "TestName",
email: "[email protected]",
organizations: [
superVolOrganizations: [],
texterOrganizations: [
{
id: 2,
name: "testOrg"
Expand Down
50 changes: 18 additions & 32 deletions __test__/integrations/action-handlers/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { r, createLoaders } from "../../../src/server/models";
import { r } from "../../../src/server/models";
import each from "jest-each";
import {
setupTest,
Expand Down Expand Up @@ -532,12 +532,9 @@ describe("action-handlers/index", () => {
});

describe("#getActionChoiceData", () => {
let loaders;
let expectedReturn;

beforeEach(async () => {
loaders = createLoaders();

expectedReturn = [
{
details: '{"hex":"#B22222","rgb":{"r":178,"g":34,"b":34}}',
Expand All @@ -557,38 +554,36 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
ComplexTestAction,
organization,
user,
loaders
user
);

expect(returned).toEqual(expectedReturn);

expect(ComplexTestAction.clientChoiceDataCacheKey.mock.calls).toEqual([
[organization, user, loaders]
[organization, user]
]);

expect(ComplexTestAction.getClientChoiceData.mock.calls).toEqual([
[organization, user, loaders]
[organization, user]
]);

// handles the second call from the cache
const secondCallReturned = await ActionHandlers.getActionChoiceData(
ComplexTestAction,
organization,
user,
loaders
user
);

expect(secondCallReturned).toEqual(expectedReturn);

expect(ComplexTestAction.clientChoiceDataCacheKey.mock.calls).toEqual([
[organization, user, loaders],
[organization, user, loaders]
[organization, user],
[organization, user]
]);

expect(ComplexTestAction.getClientChoiceData.mock.calls).toEqual([
[organization, user, loaders],
...(!r.redis && [[organization, user, loaders]])
[organization, user],
...(!r.redis && [[organization, user]])
]);
});

Expand All @@ -597,8 +592,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
TestAction,
organization,
user,
loaders
user
);
expect(returned).toEqual([]);
});
Expand All @@ -621,8 +615,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
{ id: 99 },
user,
loaders
user
);
expect(returned).toEqual(expectedReturn);
expect(ActionHandlers.getSetCacheableResult.mock.calls).toEqual([
Expand All @@ -642,8 +635,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
organization,
user,
loaders
user
);
expect(returned).toEqual([]);
});
Expand All @@ -659,8 +651,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
organization,
user,
loaders
user
);
expect(returned).toEqual([]);
});
Expand All @@ -677,8 +668,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
organization,
user,
loaders
user
);
expect(returned).toEqual([]);
});
Expand All @@ -695,8 +685,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
organization,
user,
loaders
user
);
expect(returned).toEqual([]);
});
Expand All @@ -714,8 +703,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
organization,
user,
loaders
user
);
expect(returned).toEqual([]);
expect(log.error.mock.calls).toEqual([
Expand All @@ -740,8 +728,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
organization,
user,
loaders
user
);
expect(returned).toEqual(expectedReturn);
expect(log.error.mock.calls).toEqual([
Expand Down Expand Up @@ -769,8 +756,7 @@ describe("action-handlers/index", () => {
const returned = await ActionHandlers.getActionChoiceData(
fakeAction,
organization,
user,
loaders
user
);
expect(returned).toEqual([]);
expect(log.error.mock.calls).toEqual([
Expand Down
Loading