Feature: Add service worker registration method to plugin API

This commit is contained in:
Jeff Wong
2017-11-22 17:02:01 -08:00
committed by Guo Xiang Tan
parent 46f8a6c97d
commit b094894c94
9 changed files with 93 additions and 23 deletions

View File

@ -92,6 +92,25 @@ describe DiscoursePluginRegistry do
end
end
context '.register_service_worker' do
let(:registry) { DiscoursePluginRegistry }
before do
registry.register_service_worker('hello.js')
end
after do
registry.reset!
end
it "should register the file once" do
2.times { registry.register_service_worker('hello.js') }
expect(registry.service_workers.size).to eq(1)
expect(registry.service_workers).to include('hello.js')
end
end
context '.register_archetype' do
it "delegates archetypes to the Archetype component" do
Archetype.expects(:register).with('threaded', hello: 123)