Skip to content

Commit

Permalink
Merge pull request #19 from gowizzard/development
Browse files Browse the repository at this point in the history
test: Update test functions.
  • Loading branch information
gowizzard authored Nov 8, 2023
2 parents 0f6f22b + f65a282 commit 725219f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/escape/bytes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ func TestBytes(t *testing.T) {
expected string
}{
{
name: "function.js",
name: "add_last_updated.js",
v: []byte("#!js name=play api_version=1.0\n\nfunction ping(client, data) {\n return client.call('ping');\n}\n\nredis.registerFunction('ping', ping);"),
expected: "\"#!js name=play api_version=1.0\\n\\nfunction ping(client, data) {\\n return client.call('ping');\\n}\\n\\nredis.registerFunction('ping', ping);\"",
},
{
name: "trigger.js",
name: "ping.js",
v: []byte("#!js name=trigger api_version=1.0\n\nfunction setLastUpdate(client, data) {\n if(data.event == \"hset\") {\n const time = new Date();\n client.call(\"hset\", data.key, \"last_update\", time.toISOString());\n }\n}\n\nredis.registerKeySpaceTrigger(\"addLastUpdated\", \"shop:\", setLastUpdate);"),
expected: "\"#!js name=trigger api_version=1.0\\n\\nfunction setLastUpdate(client, data) {\\n if(data.event == \\\"hset\\\") {\\n const time = new Date();\\n client.call(\\\"hset\\\", data.key, \\\"last_update\\\", time.toISOString());\\n }\\n}\\n\\nredis.registerKeySpaceTrigger(\\\"addLastUpdated\\\", \\\"shop:\\\", setLastUpdate);\"",
},
Expand Down
4 changes: 2 additions & 2 deletions internal/read/directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ func TestDirectory(t *testing.T) {
content string
}{
{
name: "trigger.js",
name: "ping.js",
content: "#!js name=trigger api_version=1.0\n\nfunction setLastUpdate(client, data) {\n if(data.event == \"hset\") {\n const time = new Date();\n client.call(\"hset\", data.key, \"last_update\", time.toISOString());\n }\n}\n\nredis.registerKeySpaceTrigger(\"addLastUpdated\", \"shop:\", setLastUpdate);",
},
{
name: "function.js",
name: "add_last_updated.js",
content: "#!js name=play api_version=1.0\n\nfunction ping(client, data) {\n return client.call('ping');\n}\n\nredis.registerFunction('ping', ping);",
},
}
Expand Down

0 comments on commit 725219f

Please sign in to comment.