Skip to content

Commit

Permalink
Update all template components in tests to use new style types
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jun 10, 2024
1 parent 50bcb45 commit b6e3b34
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions assets/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type TemplateUUID uuids.UUID
// },
// "components": [
// {
// "type": "body",
// "name": "body",
// "type": "body/text",
// "content": "Hello {{1}}",
// "variables": {"1": 0}
// }
Expand All @@ -40,8 +40,8 @@ type TemplateUUID uuids.UUID
// },
// "components": [
// {
// "type": "body",
// "name": "body",
// "type": "body/text",
// "content": "Bonjour {{1}}",
// "variables": {"1": 0}
// }
Expand Down
6 changes: 3 additions & 3 deletions flows/actions/testdata/_assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@
"locale": "eng-US",
"components": [
{
"type": "body",
"name": "body",
"type": "body/text",
"content": "Hi {{1}}, who's an excellent {{2}}?",
"variables": {
"1": 0,
Expand All @@ -285,8 +285,8 @@
"locale": "spa",
"components": [
{
"type": "body",
"name": "body",
"type": "body/text",
"content": "Hola {{1}}, quien es un {{2}} excelente?",
"variables": {
"1": 0,
Expand Down Expand Up @@ -317,8 +317,8 @@
"locale": "eng",
"components": [
{
"type": "body",
"name": "body",
"type": "body/text",
"content": "Hi there, it's time to get up!",
"variables": {}
}
Expand Down
6 changes: 3 additions & 3 deletions flows/actions/testdata/send_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@
"namespace": "",
"components": [
{
"type": "body",
"name": "body",
"type": "body/text",
"variables": {
"1": 0,
"2": 1
Expand Down Expand Up @@ -538,8 +538,8 @@
"namespace": "",
"components": [
{
"type": "body",
"name": "body",
"type": "body/text",
"variables": {
"1": 0,
"2": 1
Expand Down Expand Up @@ -851,8 +851,8 @@
}
},
{
"type": "button/quick_reply",
"name": "button.0",
"type": "button/quick_reply",
"variables": {
"1": 2
}
Expand Down
6 changes: 3 additions & 3 deletions flows/msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ func TestMsgTemplating(t *testing.T) {
msgTemplating := flows.NewMsgTemplating(
templateRef,
"0162a7f4_dfe4_4c96_be07_854d5dba3b2b",
[]*flows.TemplatingComponent{{Type: "body", Name: "body", Variables: map[string]int{"1": 0, "2": 1}}},
[]*flows.TemplatingComponent{{Type: "body/text", Name: "body", Variables: map[string]int{"1": 0, "2": 1}}},
[]*flows.TemplatingVariable{{Type: "text", Value: "Ryan Lewis"}, {Type: "text", Value: "boy"}},
)

assert.Equal(t, templateRef, msgTemplating.Template)
assert.Equal(t, "0162a7f4_dfe4_4c96_be07_854d5dba3b2b", msgTemplating.Namespace)
assert.Equal(t, []*flows.TemplatingComponent{{Type: "body", Name: "body", Variables: map[string]int{"1": 0, "2": 1}}}, msgTemplating.Components)
assert.Equal(t, []*flows.TemplatingComponent{{Type: "body/text", Name: "body", Variables: map[string]int{"1": 0, "2": 1}}}, msgTemplating.Components)
assert.Equal(t, []*flows.TemplatingVariable{{Type: "text", Value: "Ryan Lewis"}, {Type: "text", Value: "boy"}}, msgTemplating.Variables)

// test marshaling our msg
Expand All @@ -187,8 +187,8 @@ func TestMsgTemplating(t *testing.T) {
"namespace":"0162a7f4_dfe4_4c96_be07_854d5dba3b2b",
"components":[
{
"type": "body",
"name": "body",
"type": "body/text",
"variables": {"1": 0, "2": 1}
}
],
Expand Down

0 comments on commit b6e3b34

Please sign in to comment.