Test coverage on Ruby side
parent
c0ae56651e
commit
5a8e3f2eb9
|
@ -25,21 +25,21 @@ class Device < ApplicationRecord
|
|||
logs.all.last(max_log_count || DEFAULT_MAX_LOGS)
|
||||
end
|
||||
|
||||
def auth_token
|
||||
SessionToken.as_json(self.users.first)[:token].encoded
|
||||
end
|
||||
# def auth_token
|
||||
# SessionToken.as_json(self.users.first)[:token].encoded
|
||||
# end
|
||||
|
||||
# Send a realtime message to a logged in user.
|
||||
def tell(message, chan = "toast")
|
||||
log = Log.new({ device: self,
|
||||
message: message,
|
||||
created_at: Time.now,
|
||||
channels: [chan],
|
||||
meta: { type: "info" } })
|
||||
json = LogSerializer.new(log).as_json.to_json
|
||||
# # Send a realtime message to a logged in user.
|
||||
# def tell(message, chan = "toast")
|
||||
# log = Log.new({ device: self,
|
||||
# message: message,
|
||||
# created_at: Time.now,
|
||||
# channels: [chan],
|
||||
# meta: { type: "info" } })
|
||||
# json = LogSerializer.new(log).as_json.to_json
|
||||
|
||||
Transport.amqp_send(json, self.id, "logs")
|
||||
end
|
||||
# Transport.amqp_send(json, self.id, "logs")
|
||||
# end
|
||||
|
||||
def self.current
|
||||
RequestStore.store[:device]
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
require 'spec_helper'
|
||||
describe TokenExpiration do
|
||||
let(:regimen) { FactoryBot.create(:regimen) }
|
||||
|
||||
it "Never broadcasts changes and isnt even used right now" do
|
||||
expect(TokenExpiration.new.broadcast?).to be false
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
import * as React from "react";
|
||||
import { EncoderType, EncoderTypeProps } from "../encoder_type";
|
||||
import { shallow } from "enzyme";
|
||||
import { FBSelect } from "../../../ui/new_fb_select";
|
||||
|
||||
describe("<EncoderType/>", () => {
|
||||
it("renders default content", () => {
|
||||
const props: EncoderTypeProps = {
|
||||
hardware: {
|
||||
encoder_type_x: 1,
|
||||
encoder_type_y: 1,
|
||||
encoder_type_z: 1
|
||||
},
|
||||
onChange: jest.fn()
|
||||
};
|
||||
const el = shallow(<EncoderType {...props} />);
|
||||
expect(el.find(FBSelect).length).toEqual(3);
|
||||
// EncoderType
|
||||
});
|
||||
});
|
|
@ -4,7 +4,7 @@ import { t } from "i18next";
|
|||
import { FBSelect } from "../../ui/new_fb_select";
|
||||
import { DropDownItem } from "../../ui/fb_select";
|
||||
|
||||
interface EncoderTypeProps {
|
||||
export interface EncoderTypeProps {
|
||||
hardware: McuParams;
|
||||
onChange(key: McuParamName, value: Encoder): void;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue