Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review ProjectTHTest #4

Open
rickybustillos opened this issue Nov 8, 2021 · 1 comment
Open

Review ProjectTHTest #4

rickybustillos opened this issue Nov 8, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rickybustillos
Copy link
Member

7dad9a3#diff-577d62b36e2dae6cd625f41f3edbaca0ed6919f521fb344a72084d0d60b2a7c8

@isTest
public class ProjectTHTest {

    @isTest
    public static void givenCreatedProjectWhenSyncProjectThenReturnSyncStatus() {

        User user = UserFixtureFactory.getUser();

        String expectedPayload = TopiRun2021FixtureFactory.newProjectPayload();

        Project__c projectToSync = ProjectFixtureFactory.createProject();

        ProjectRepository repository = new ProjectRepository();

        Test.setMock(HttpCalloutMock.class, new TopiRun2021ProjectHttpMock(expectedPayload, 200));
        System.runAs(user) {

            projectToSync.Status__c = 'Iniciado';
            repository.save(projectToSync);

            Project__c synchronizedProject = repository.findById(projectToSync.Id);

            System.assertEquals('Iniciado', synchronizedProject.Status__c);
            System.assertEquals('Enterprise', synchronizedProject.Type__c);

            // todo: discover how to fix this issue
            // for some reason, the project isn't entering afterUpdate and SyncStatus attr isn't updating
            // System.assertEquals('Integrado com sucesso', synchronizedProject.SynchronizationStatus__c);
        }        
    }
}
@rickybustillos rickybustillos added the bug Something isn't working label Nov 8, 2021
@rickybustillos rickybustillos self-assigned this Nov 8, 2021
@rickybustillos
Copy link
Member Author

Probably the project is entering afterUpdate and updating it, but the repository.findById method in line 24 is not returning updated data

@rickybustillos rickybustillos pinned this issue Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant