Skip to content

Commit

Permalink
Merge branch 'master' into chasefleming/1.4.1-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
chasefleming authored Nov 15, 2022
2 parents edeaee9 + b2881f7 commit 82fad28
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/thirty-snails-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/fcl": patch
---

Fix invariant type checks in FCL Interaction Template getter utils
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@ export function getTemplateArgumentMessage({
}) {
invariant(
messageKey,
"getMessage({ messageKey }) -- messageKey must be defined"
"getTemplateArgumentMessage({ messageKey }) -- messageKey must be defined"
)
invariant(
typeof messageKey === "stirng",
"getMessage({ messageKey }) -- messageKey must be a string"
typeof messageKey === "string",
"getTemplateArgumentMessage({ messageKey }) -- messageKey must be a string"
)

invariant(
argumentLabel,
"getMessage({ argumentLabel }) -- argumentLabel must be defined"
"getTemplateArgumentMessage({ argumentLabel }) -- argumentLabel must be defined"
)
invariant(
typeof messageKey === "stirng",
"getMessage({ argumentLabel }) -- argumentLabel must be a string"
typeof messageKey === "string",
"getTemplateArgumentMessage({ argumentLabel }) -- argumentLabel must be a string"
)

invariant(
localization,
"getMessage({ localization }) -- localization must be defined"
"getTemplateArgumentMessage({ localization }) -- localization must be defined"
)
invariant(
typeof localization === "stirng",
"getMessage({ localization }) -- localization must be a string"
typeof localization === "string",
"getTemplateArgumentMessage({ localization }) -- localization must be a string"
)

invariant(
template != undefined,
"generateTemplateId({ template }) -- template must be defined"
"getTemplateArgumentMessage({ template }) -- template must be defined"
)
invariant(
typeof template === "object",
"generateTemplateId({ template }) -- template must be an object"
"getTemplateArgumentMessage({ template }) -- template must be an object"
)
invariant(
typeof template.f_type === "InteractionTemplate",
"generateTemplateId({ template }) -- template object must be an InteractionTemplate"
"getTemplateArgumentMessage({ template }) -- template object must be an InteractionTemplate"
)

const args = template?.data?.arguments
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getTemplateArgumentMessage} from "./get-template-argument-message.js"

describe("Derive cadence by network", () => {
describe("Get interaction template argument messages", () => {
let template = {
f_type: "InteractionTemplate",
f_version: "1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ export function getTemplateMessage({
}) {
invariant(
messageKey,
"getMessage({ messageKey }) -- messageKey must be defined"
"getTemplateMessage({ messageKey }) -- messageKey must be defined"
)
invariant(
typeof messageKey === "stirng",
"getMessage({ messageKey }) -- messageKey must be a string"
typeof messageKey === "string",
"getTemplateMessage({ messageKey }) -- messageKey must be a string"
)

invariant(
localization,
"getMessage({ localization }) -- localization must be defined"
"getTemplateMessage({ localization }) -- localization must be defined"
)
invariant(
typeof localization === "stirng",
"getMessage({ localization }) -- localization must be a string"
typeof localization === "string",
"getTemplateMessage({ localization }) -- localization must be a string"
)

invariant(
template != undefined,
"generateTemplateId({ template }) -- template must be defined"
"getTemplateMessage({ template }) -- template must be defined"
)
invariant(
typeof template === "object",
"generateTemplateId({ template }) -- template must be an object"
"getTemplateMessage({ template }) -- template must be an object"
)
invariant(
typeof template.f_type === "InteractionTemplate",
"generateTemplateId({ template }) -- template object must be an InteractionTemplate"
"getTemplateMessage({ template }) -- template object must be an InteractionTemplate"
)

const messages = template?.data?.messages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getTemplateMessage} from "./get-template-message.js"

describe("Derive cadence by network", () => {
describe("Get interaction template messages", () => {
let template = {
f_type: "InteractionTemplate",
f_version: "1.0.0",
Expand Down

0 comments on commit 82fad28

Please sign in to comment.