Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
1 change: 0 additions & 1 deletion public/acuant/11.4.3/AcuantImageProcessingWorker.min.js

This file was deleted.

Binary file not shown.
1 change: 0 additions & 1 deletion public/acuant/11.4.3/AcuantJavascriptWebSdk.min.js

This file was deleted.

75 changes: 35 additions & 40 deletions spec/requests/acuant_sdk_spec.rb
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
require 'rails_helper'

describe 'requesting acuant SDK assets' do
base_urls = ['/acuant/11.4.3', '/acuant/11.5.0', '/acuant/11.5.1']

base_urls.each do |base_url|
min_js = base_url != '/acuant/11.4.3' ?
"#{base_url}/AcuantImageWorker.min.js" :
"#{base_url}/AcuantImageProcessingWorker.min.js"
context min_js do
before { get min_js }

it 'renders a JS asset' do
expect(response.status).to eq(200)
expect(response.headers['Content-Type']).to eq('application/javascript')
end

it 'does not include a CSP header' do
expect(response.headers).to_not have_key('Content-Security-Policy')
end

it 'does not include a session' do
expect(response.cookies.keys).to_not include('_upaya_session')
end
version = Pathname.new(Dir[Rails.root.join('public/acuant/*')].first).basename.to_s
base_url = "/acuant/#{version}"

min_js = "#{base_url}/AcuantImageWorker.min.js"
context min_js do
before { get min_js }

it 'renders a JS asset' do
expect(response.status).to eq(200)
expect(response.headers['Content-Type']).to eq('application/javascript')
end

wasm_js = base_url != '/acuant/11.4.3' ?
"#{base_url}/AcuantImageService.wasm" :
"#{base_url}/AcuantImageProcessingWorker.wasm"
context wasm_js do
before { get wasm_js }
it 'does not include a CSP header' do
expect(response.headers).to_not have_key('Content-Security-Policy')
end

it 'renders a WASM asset' do
expect(response.status).to eq(200)
expect(response.headers['Content-Type']).to eq('application/wasm')
end
it 'does not include a session' do
expect(response.cookies.keys).to_not include('_upaya_session')
end
end

it 'does not include a session' do
expect(response.cookies.keys).to_not include('_upaya_session')
end
wasm_js = "#{base_url}/AcuantImageService.wasm"
context wasm_js do
before { get wasm_js }

it 'renders a WASM asset' do
expect(response.status).to eq(200)
expect(response.headers['Content-Type']).to eq('application/wasm')
end

it 'does not include a session' do
expect(response.cookies.keys).to_not include('_upaya_session')
end
end

invalid_asset = "#{base_url}/something-that-does-not-exist/AcuantImageService.wasm"
context "#{invalid_asset} (invalid asset)" do
before { get invalid_asset }
invalid_asset = "#{base_url}/something-that-does-not-exist/AcuantImageService.wasm"
context "#{invalid_asset} (invalid asset)" do
before { get invalid_asset }

it 'renders a 404 and leaves in the CSP headers' do
expect(response.status).to eq(404)
expect(response.headers['Content-Security-Policy']).to be_present
end
it 'renders a 404 and leaves in the CSP headers' do
expect(response.status).to eq(404)
expect(response.headers['Content-Security-Policy']).to be_present
end
end
end