You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.2 KiB
JavaScript
79 lines
1.2 KiB
JavaScript
"use strict";
|
|
|
|
const immutable = require("immutable");
|
|
const util = require("util");
|
|
|
|
const data = require("./src/shared/reducer");
|
|
|
|
let store = data.createStore();
|
|
|
|
store.dispatch({
|
|
type: "connected",
|
|
username: "joepie91",
|
|
displayName: "Sven Slootweg",
|
|
status: "online",
|
|
friends: [data.Friend({
|
|
username: "johndoe",
|
|
displayName: "John Doe",
|
|
status: "online",
|
|
mutual: true
|
|
})]
|
|
});
|
|
|
|
store.dispatch({
|
|
type: "friendAdded",
|
|
friend: data.Friend({
|
|
username: "foo"
|
|
})
|
|
});
|
|
|
|
store.dispatch({
|
|
type: "messageSent",
|
|
message: data.Message({
|
|
id: 0,
|
|
sender: "joepie91",
|
|
recipient: "johndoe",
|
|
body: "Hi yes hello",
|
|
timestamp: "22:01"
|
|
})
|
|
});
|
|
|
|
store.dispatch({
|
|
type: "messageSentDBStored",
|
|
messageId: 0
|
|
});
|
|
|
|
store.dispatch({
|
|
type: "messageDelivered",
|
|
messageId: 0
|
|
});
|
|
|
|
store.dispatch({
|
|
type: "messageDeliveredDBStored",
|
|
messageId: 0
|
|
});
|
|
|
|
store.dispatch({
|
|
type: "messageReceived",
|
|
message: data.Message({
|
|
id: 1,
|
|
sender: "johndoe",
|
|
recipient: "joepie91",
|
|
body: "hi",
|
|
timestamp: "22:03"
|
|
})
|
|
});
|
|
|
|
store.dispatch({
|
|
type: "messageSent",
|
|
message: data.Message({
|
|
id: 0,
|
|
sender: "joepie91",
|
|
recipient: "johndoe",
|
|
body: "Foo Bar",
|
|
timestamp: "22:04"
|
|
})
|
|
});
|
|
|
|
console.log(util.inspect(store.getState().toJS(), {colors: true, depth: null}));
|