xrforge-v2/src/test/plugin_openbrush.lua

55 lines
1.8 KiB
Lua
Raw Normal View History

return function(lust)
local describe, it, expect = lust.describe, lust.it, lust.expect
describe('src/plugin/openbrush.lua', function()
describe('get API url', function() -- Can be nested
local url = app.plugin.openbrush.apiCall()
expect( url:match('https://') ).to.be.truthy()
end)
describe('parse icosa.gallery json', function() -- Can be nested
local json = util.readfile('/zip/test/json/icosagallery.json')
local opts = {body=json}
local t = app.plugin.openbrush.fetch('',opts)
expect( t.assets and #t.assets > 0 ).to.be.truthy()
end)
describe('ℹ️ grid-layout', function() -- Can be nested
it('unwrap janusxr-room for assets', function()
app.init()
app.use( require('page/dir').middleware )
app.use( app.response() )
app.on('response', function(opts)
expect( not opts.res._body:match('/myverse/tronverse/tronverse-icosagallery/_0dycp4HDxf4-tronverse_floor-overlay-tronverse-icosagallery/tronverse_floor.glb') ).to.be.truthy()
end)
local url = '/myverse/tronverse/tronverse-icosagallery'
foreach(app.cache.items, function(k,exp)
if exp.url:match(url) then
if exp.url:match( url .. "$") then
--print_r(exp)
lust.queueServerRequest('GET', url, nil, nil, nil, nil, nil, 8080 )
app.run()
end
end
end)
end)
end)
--describe('download icosa.gallery assets', function() -- Can be nested
-- local json = util.readfile('/zip/test/json/icosagallery.json')
-- local opts = {body=json}
-- foreach( app.plugin.openbrush.fetch(opts), function(i,t)
-- local res = app.plugin.openbrush.download(t)
-- expect( res ).to.be.truthy()
-- end)
--end)
end)
end