Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3010186
test-app.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
test-app.ts
View Options
/* eslint-disable */
import
locreq_curry
from
"locreq"
;
const
locreq
=
locreq_curry
(
__dirname
);
import
{
App
,
SMTPMailer
}
from
"../main"
;
import
type
{
Environment
}
from
"../app/config"
;
import
type
{
LoggerLevel
}
from
"../app/logger"
;
import
LoggerMailer
from
"../email/logger-mailer"
;
export
class
TestApp
extends
App
{
clear_database_on_stop
:
boolean
=
true
;
collections
=
{
...
App
.
BaseCollections
};
constructor
(
uniq_id
:
string
,
env
:
Environment
,
port
:
number
,
base_url
:
string
,
public
config
=
{
upload_path
:
"/tmp"
,
datastore_mongo
:
{
host
:
process
.
env
.
SEALIOUS_DB_HOST
||
"127.0.0.1"
,
password
:
"sealious-test"
,
port
:
parseInt
(
process
.
env
.
SEALIOUS_DB_PORT
||
"20722"
),
db_name
:
"sealious-test"
,
},
email
:
{
from_name
:
"Sealious test app"
,
from_address
:
`sealious-
${
uniq_id
}
@example.com`
,
},
core
:
{
environment
:
env
},
app
:
{
version
:
"0.0.0-test"
},
logger
:
{
level
:
(
process
.
env
.
SEALIOUS_DEBUG
||
"none"
)
as
LoggerLevel
,
// level: "debug3",
},
"www-server"
:
{
port
,
},
password_hash
:
{
iterations
:
1
,
},
},
public
manifest
=
{
name
:
"testing app"
,
logo
:
locreq
.
resolve
(
"src/assets/logo.png"
),
default_language
:
"pl"
,
version
:
"0.0.0-test"
,
base_url
,
colors
:
{
primary
:
"#4d394b"
,
},
admin_email
:
"admin@example.com"
,
},
public
mailer
=
env
==
"production"
?
new
SMTPMailer
({
host
:
process
.
env
.
SEALIOUS_SMTP_HOST
||
"127.0.0.1"
,
port
:
parseInt
(
process
.
env
.
SEALIOUS_SMTP_PORT
||
"1825"
),
user
:
"any"
,
password
:
"any"
,
})
:
new
LoggerMailer
()
)
{
super
();
}
async
start
()
{
this
.
on
(
"stopping"
,
async
()
=>
{
if
(
this
.
clear_database_on_stop
&&
this
.
Datastore
.
db
)
{
this
.
Logger
.
info
(
"TEST APP"
,
"Clearing the database..."
);
for
(
const
collection_name
in
this
.
collections
)
{
await
this
.
Datastore
.
remove
(
collection_name
,
{},
"just_one"
&&
false
);
}
await
this
.
Datastore
.
remove
(
this
.
Metadata
.
db_collection_name
,
{},
"just_one"
&&
false
);
}
});
await
super
.
start
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, May 7, 19:37 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
630961
Default Alt Text
test-app.ts (2 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment