Skip to content

Commit ceba440

Browse files
committed
refactor: format
1 parent 4634ea1 commit ceba440

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

lib/web_push_elixir/main.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@ navigator.serviceWorker
77
console.error('Unable to register service worker.', err);
88
});
99

10-
document.addEventListener('DOMContentLoaded', event => {
10+
document.addEventListener('DOMContentLoaded', event => {
1111

12-
const button = document.querySelector('button');
12+
const button = document.querySelector('button');
1313

14-
button.addEventListener('click', event => {
14+
button.addEventListener('click', event => {
1515

16-
Notification.requestPermission().then(permission => {
16+
Notification.requestPermission().then(permission => {
1717

18-
navigator.serviceWorker.ready.then(registration => {
18+
navigator.serviceWorker.ready.then(registration => {
1919

20-
console.log('Service worker is active');
20+
console.log('Service worker is active');
2121

22-
registration.showNotification('Notification Test', {
23-
body: 'Some message',
24-
});
22+
registration.showNotification('Notification Test', {
23+
body: 'Some message',
2524
});
26-
})
27-
});
28-
25+
});
26+
})
2927
});
28+
});

test/test_helper.exs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
ExUnit.start()
22

3-
DynamicSupervisor.start_child(WebPushElixir.DynamicSupervisor, {Plug.Cowboy, scheme: :http, plug: WebPushElixir.MockServer, options: [port: 4040]})
3+
DynamicSupervisor.start_child(
4+
WebPushElixir.DynamicSupervisor,
5+
{Plug.Cowboy, scheme: :http, plug: WebPushElixir.MockServer, options: [port: 4040]}
6+
)

test/web_push_elixir_test.exs

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule WebPushElixirTest do
33

44
import ExUnit.CaptureLog
55

6-
@subscription_from_client '{"endpoint":"http://localhost:4040/some-endpoint","keys":{"p256dh":"BIPUL12DLfytvTajnryr2PRdAgXS3HGKiLqndGcJGabyhHheJYlNGCeXl1dn18gSJ1WAkAPIxr4gK0_dQds4yiI=","auth":"FPssNDTKnInHVndSTdbKFw=="}}'
6+
@subscription_from_client ~c"{\"endpoint\":\"http://localhost:4040/some-endpoint\",\"keys\":{\"p256dh\":\"BIPUL12DLfytvTajnryr2PRdAgXS3HGKiLqndGcJGabyhHheJYlNGCeXl1dn18gSJ1WAkAPIxr4gK0_dQds4yiI=\",\"auth\":\"FPssNDTKnInHVndSTdbKFw==\"}}"
77
@subscription_decoded %{
88
endpoint: "http://localhost:4040/some-endpoint",
99
keys: %{
@@ -17,11 +17,17 @@ defmodule WebPushElixirTest do
1717
@server_public_key_length 65
1818

1919
test "it should output key pair" do
20-
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~ "public_key:"
21-
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~ "private_key:"
22-
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~ "subject:"
20+
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~
21+
"public_key:"
2322

24-
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~ "mailto:[email protected]"
23+
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~
24+
"private_key:"
25+
26+
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~
27+
"subject:"
28+
29+
assert capture_log(WebPushElixir.gen_key_pair() |> WebPushElixir.output_key_pair()) =~
30+
2531
end
2632

2733
test "it should decode" do

0 commit comments

Comments
 (0)