Update functional test dependencies

This commit is contained in:
Claudemiro
2018-11-25 21:24:05 +01:00
parent 8da763ec2f
commit 964df8a5dd
3 changed files with 32 additions and 21 deletions
+5 -6
View File
@@ -2,22 +2,21 @@
<head>
<meta charset="utf-8">
<title>Pusher Spec</title>
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet"/>
<link href="//cdnjs.cloudflare.com/ajax/libs/mocha/5.2.0/mocha.min.css" rel="stylesheet"/>
</head>
<body>
<div id="mocha"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/3.4.1/chai.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/mocha/5.2.0/mocha.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/chai/4.2.0/chai.min.js"></script>
<script src="//js.pusher.com/3.2/pusher.min.js"></script>
<script src="//js.pusher.com/4.3.1/pusher.min.js"></script>
<script>mocha.setup('bdd')</script>
<script src="test.pusher.js"></script>
<script>
mocha.checkLeaks();
mocha.globals(['jQuery', 'Pusher']);
mocha.globals(['Pusher']);
mocha.run();
</script>
</body>
+17 -6
View File
@@ -1,6 +1,7 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
@@ -14,11 +15,10 @@ var client pusher.Client
func init() {
client = pusher.Client{
AppId: "1",
Key: "278d525bdf162c739803",
Secret: "7ad3753142a6693b25b9",
Host: ":8080",
Cluster: "hello",
AppId: "1",
Key: "278d525bdf162c739803",
Secret: "7ad3753142a6693b25b9",
Host: ":8080",
}
}
@@ -69,7 +69,18 @@ func hookcallback(res http.ResponseWriter, r *http.Request) {
}
fmt.Println(string(bytes))
_, err = client.Trigger("private-webhook", "mywebhook", "The Webhoook from server")
event := struct {
Events []struct {
Name string `json:"name"`
} `json:"events"`
}{}
err = json.NewDecoder(r.Body).Decode(&event)
if err != nil {
panic(err)
}
_, err = client.Trigger("private-webhook", event.Events[0].Name, "The Webhoook from server")
if err != nil {
panic(err)
}
+10 -9
View File
@@ -1,3 +1,5 @@
"use strict";
let assert = chai.assert;
let APP_KEY = "278d525bdf162c739803";
@@ -17,7 +19,6 @@ function getPusher(auth) {
authEndpoint: auth,
enabledTransports: ["ws"],
disabledTransports: ["flash"],
cluster: "hello", // Should be ignored
});
}
@@ -53,7 +54,7 @@ describe("Pusher", function () {
let pusher = getPusher(AUTH);
let channel = pusher.subscribe('public-channel');
channel.bind("pusher:subscription_succeeded", function (data) {
channel.bind("pusher:subscription_succeeded", function () {
assert.ok(true, "Connected to the channel");
done();
});
@@ -63,7 +64,7 @@ describe("Pusher", function () {
let pusher = getPusher(AUTH);
let channel = pusher.subscribe('private-channel');
channel.bind("pusher:subscription_succeeded", function (data) {
channel.bind("pusher:subscription_succeeded", function () {
assert.ok(true, "Connected to the channel");
done();
});
@@ -73,7 +74,7 @@ describe("Pusher", function () {
let pusher = getPusher(AUTH_PRESENCE);
let channel = pusher.subscribe('presence-channel');
channel.bind("pusher:subscription_succeeded", function (data) {
channel.bind("pusher:subscription_succeeded", function () {
assert.ok(true, "Connected to the channel");
done();
});
@@ -85,13 +86,13 @@ describe("Pusher", function () {
let pusher = getPusher(AUTH);
let channel = pusher.subscribe('private-webhook');
channel.bind("pusher:subscription_succeeded", function (data) {
channel.bind("pusher:subscription_succeeded", function () {
console.log("subscribed");
});
channel.bind("mywebhook", function (data) {
console.log(data);
channel.bind("channel_occupied", function (data) {
assert.equal(data, "The Webhoook from server");
pusher.unsubscribe('private-webhook');
done();
});
});
@@ -102,11 +103,11 @@ describe("Pusher", function () {
let pusher = getPusher(AUTH);
let channel = pusher.subscribe('public-channel');
channel.bind("pusher:subscription_succeeded", function (data) {
channel.bind("pusher:subscription_succeeded", function () {
channel.trigger("client-message", "The message");
});
pusher.bind("pusher:error", function (data) {
pusher.bind("pusher:error", function () {
assert.ok(true, "Expected error");
done();
});