NebulaLogger icon indicating copy to clipboard operation
NebulaLogger copied to clipboard

SYNCHRONOUS_DML in a test context - Integration test

Open jongpie opened this issue 1 year ago • 0 comments

Discussed in https://github.com/jongpie/NebulaLogger/discussions/454

Originally posted by JeroenSfdc February 22, 2023 If I'd like to do an integration test with SYNCHRONOUS_DML it fails (where it succeeds with EVENT_BUS). I tried to get my head around this... This is using the managed package ~~v4.8~~ v4.9. @jongpie

    @IsTest
    static void testNebula_SyncDML() {
        Nebula.Logger.error('Some random error');

        Test.startTest();
        Nebula.Logger.saveLog(Nebula.Logger.SaveMethod.SYNCHRONOUS_DML);
        Test.stopTest();

        Assert.areEqual(1, [SELECT Id FROM Nebula__Log__c].size());
        Assert.areEqual(1, [SELECT Id FROM Nebula__LogEntry__c].size());
    }

jongpie avatar Feb 23 '23 22:02 jongpie