2015-11-21 09:27:06 +08:00
|
|
|
import EmailLog from "admin/models/email-log";
|
2020-06-04 00:45:26 +08:00
|
|
|
import { setPrefix } from "discourse-common/lib/get-url";
|
2015-11-21 09:27:06 +08:00
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.module("Discourse.EmailLog");
|
2013-10-30 01:01:42 +08:00
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("create", assert => {
|
|
|
|
assert.ok(EmailLog.create(), "it can be created without arguments");
|
|
|
|
});
|
2018-08-09 04:47:54 +08:00
|
|
|
|
|
|
|
QUnit.test("subfolder support", assert => {
|
2020-06-04 00:45:26 +08:00
|
|
|
setPrefix("/forum");
|
2018-08-09 04:47:54 +08:00
|
|
|
const attrs = {
|
|
|
|
id: 60,
|
|
|
|
to_address: "wikiman@asdf.com",
|
|
|
|
email_type: "user_linked",
|
|
|
|
user_id: 9,
|
|
|
|
created_at: "2018-08-08T17:21:52.022Z",
|
|
|
|
post_url: "/t/some-pro-tips-for-you/41/5",
|
|
|
|
post_description: "Some Pro Tips For You",
|
|
|
|
bounced: false,
|
|
|
|
user: {
|
|
|
|
id: 9,
|
|
|
|
username: "wikiman",
|
|
|
|
avatar_template:
|
|
|
|
"/forum/letter_avatar_proxy/v2/letter/w/dfb087/{size}.png"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const emailLog = EmailLog.create(attrs);
|
|
|
|
assert.equal(
|
|
|
|
emailLog.get("post_url"),
|
|
|
|
"/forum/t/some-pro-tips-for-you/41/5",
|
|
|
|
"includes the subfolder in the post url"
|
|
|
|
);
|
|
|
|
});
|