From de62b11fd2203816306ba94226874b2e62420e83 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期五, 15 四月 2022 09:42:05 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlympusSSBG
---
force-app/main/default/classes/LogAutoSendScheduleTest.cls | 26 +++++++++-----------------
1 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/force-app/main/default/classes/LogAutoSendScheduleTest.cls b/force-app/main/default/classes/LogAutoSendScheduleTest.cls
index e5dbec1..bcdb578 100644
--- a/force-app/main/default/classes/LogAutoSendScheduleTest.cls
+++ b/force-app/main/default/classes/LogAutoSendScheduleTest.cls
@@ -1,21 +1,13 @@
@isTest
private class LogAutoSendScheduleTest {
-
- static testMethod void testExecute() {
- // This test runs a scheduled job at midnight Sept. 3rd. 2022
- String CRON_EXP = '0 0 0 3 9 ? 2022';
-
- System.Test.startTest();
- // Schedule the test job
- String jobId = system.schedule('LogAutoSendScheduleTest', CRON_EXP, new LogAutoSendSchedule());
- // Get the information from the CronTrigger API object
- CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId];
- // Verify the expressions are the same
- System.assertEquals(CRON_EXP, ct.CronExpression);
- // Verify the job has not run
- System.assertEquals(0, ct.TimesTriggered);
+
+ @isTest static void test_assignOneMinute() {
+ Datetime addOneM = System.now().addMinutes(2);
+ String CRON_EXP = '0 ' + addOneM.minute() + ' ' + addOneM.hour() + ' ' + addOneM.day() + ' ' + addOneM.month() + ' ? ' + addOneM.year();
+ LogAutoSendSchedule.assignOneMinute();
+ CronTrigger oldcron = [select Id, CronJobDetail.Name from CronTrigger where CronExpression = :CRON_EXP and CronJobDetail.Name like 'LogAutoSendSBG%'];
// Verify the next time the job will run
- System.assertEquals('2022-09-03 00:00:00', String.valueOf(ct.NextFireTime));
- System.Test.StopTest();
- }
+ System.assertEquals('LogAutoSendSBG' + CRON_EXP, oldcron.CronJobDetail.Name);
+
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1