For a constant force, the force F can be taken out of the integral, to get the result
For our course we just define work in the simplest possible way: WF = Fx Δx.
We can write WF = ∫ F · v dt which is useful in making clear that the work done by any force is ZERO if either v = 0, or F · v = 0.
For our course just remember that the work done by any force is zero unless the force has a component along the direction of motion of the object.
No work is done either by the force n or the force mg.
For the fundamental forces of nature, such as gravity, the work done by or against the force is independent of the path taken.