-
Notifications
You must be signed in to change notification settings - Fork 400
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
fix tests and other tweaks related to node 20 #2353
Merged
mau11
merged 11 commits into
StateVoicesNational:new-node-20-branch
from
lperson:new-node-20-branch
Mar 25, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d79d3b0
Update a test's expectation to align with a change in a Node exception
lperson 85de014
SQLite stores dates as an integer.
lperson b263485
don't pin the version of -- fix github actions not working with node…
lperson 4d0d7b4
force CI
lperson 9518d74
try v4 instead of no version specified
lperson bce78f3
update cache to v4 to get node 20 support
lperson 9627ec6
use node version 20
lperson ec06a02
Try to pin strip-ansi
lperson 4ade484
try without caching
lperson 8f4791e
caching is not the problem; let's force strip-ansi to use a non ESM v…
lperson 44b2599
make yarn.lock consistent with pinning strip-ansi
lperson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,7 +1,7 @@ | ||
import { graphql } from "graphql"; | ||
import { isSqlite } from "../src/server/models/"; | ||
import { resolvers } from "../src/server/api/schema"; | ||
import { schema as apiSchema } from "../src/api/schema"; | ||
import { graphql } from "graphql"; | ||
|
||
console.log("This is an intentional error"); | ||
|
||
|
@@ -535,14 +535,18 @@ describe("graphql test suite", () => { | |
organization_id: organization.id, | ||
role: "OWNER" | ||
}).save(); | ||
|
||
const now = new Date(); | ||
const dueBy = isSqlite ? now.getTime() : now; | ||
|
||
// creating campaign, interactions (two levels down), and canned responses | ||
campaign = await new Campaign({ | ||
organization_id: organization.id, | ||
title: "My campaign", | ||
description: "This is my new campaign", | ||
is_started: false, | ||
is_archived: false, | ||
due_by: new Date(), | ||
due_by: dueBy, | ||
features: JSON.stringify({ MY_FEATURE: "value 1" }), | ||
intro_html: "<p>This is my intro HTML.</p>", | ||
primary_color: "#112233", | ||
|
@@ -632,30 +636,19 @@ describe("graphql test suite", () => { | |
typeof copiedCampaign.due_by === "number" || | ||
typeof copiedCampaign.due_by === "string" | ||
) { | ||
let parsedDate = new Date(copiedCampaign.due_by); | ||
const parsedDate = new Date(copiedCampaign.due_by); | ||
expect(parsedDate).toEqual(campaign.due_by); | ||
} else if (isSqlite) { | ||
expect(copiedCampaign.due_by.getTime()).toEqual(campaign.due_by); | ||
} else { | ||
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 | ||
|
||
// 3.15.2024 => Fails in SQLite testing now, but passes in PG. | ||
// copiedCampaign.due_by is an Invalid Date, and at some point | ||
// uses Date.parse() | ||
const campaignDueBy = campaign.due_by; | ||
|
||
campaignDueBy.setMilliseconds(0); | ||
expect(copiedCampaign.due_by).toEqual(campaignDueBy); | ||
} else { | ||
expect(copiedCampaign.due_by).toEqual(campaign.due_by); | ||
} | ||
expect(copiedCampaign.due_by).toEqual(campaign.due_by); | ||
} | ||
|
||
if ( | ||
typeof copiedCampaign.features === "object" && | ||
copiedCampaign.features | ||
) { | ||
let jsonString = JSON.stringify(copiedCampaign.features); | ||
const jsonString = JSON.stringify(copiedCampaign.features); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To silence the linter. |
||
expect(jsonString).toEqual(campaign.features); | ||
} else { | ||
expect(copiedCampaign.features).toEqual(campaign.features); | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To silence the linter.