Rename some device table columns, add tests for point_groups CS node. MIGRATION REQUIRED

pull/1455/head
Rick Carlino 2019-09-24 14:25:08 -05:00
parent fc1f80c4fc
commit d576656fbd
4 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,7 @@
class RenameDeviceLastOtaChecktoLastOtaCheckup < ActiveRecord::Migration[5.2]
safety_assured
def change
rename_column :devices, :last_ota_check, :last_ota_checkup
end
end

View File

@ -277,7 +277,7 @@ CREATE TABLE public.devices (
serial_number character varying(32),
mqtt_rate_limit_email_sent_at timestamp without time zone,
last_ota timestamp without time zone,
last_ota_check timestamp without time zone
last_ota_checkup timestamp without time zone
);
@ -3274,6 +3274,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20190804194135'),
('20190804194154'),
('20190823164837'),
('20190918185359');
('20190918185359'),
('20190924190539');

View File

@ -45,7 +45,7 @@
"coveralls": "3.0.6",
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.14.0",
"farmbot": "8.3.0-rc0",
"farmbot": "8.3.0-rc1",
"i18next": "17.0.16",
"lodash": "4.17.15",
"markdown-it": "10.0.0",

View File

@ -230,4 +230,30 @@ describe CeleryScript::Corpus do
expect(check.valid?).to be_falsey
expect(check.error.message).to include("cannot exceed 3 minutes")
end
it "allows valid `point_group` nodes" do
device.auto_sync_transaction do
pg = PointGroups::Create.run!(device: device,
name: "cs checks",
point_ids: [])
bad = CeleryScript::AstNode.new({
kind: "point_group",
args: { resource_id: pg.id },
})
check = CeleryScript::Checker.new(bad, corpus, device)
expect(check.valid?).to be true
end
end
it "disallows invalid `point_group` nodes" do
device.auto_sync_transaction do
bad = CeleryScript::AstNode.new({
kind: "point_group",
args: { resource_id: -1 },
})
check = CeleryScript::Checker.new(bad, corpus, device)
expect(check.valid?).to be false
expect(check.error.message).to eq("Can't find PointGroup with id of -1")
end
end
end