MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / writeAndPushFileInDev

Function writeAndPushFileInDev

tests/testFileEditor.js:805–844  ·  view source on GitHub ↗
(fileName, fileContents)

Source from the content-addressed store, hash-verified

803}
804
805function writeAndPushFileInDev(fileName, fileContents) {
806 describe(`write ${fileName} in courseDev and push to courseOrigin`, function() {
807 it('should write', function(callback) {
808 fs.writeFile(path.join(courseDevDir, fileName), fileContents, (err) => {
809 if (ERR(err, callback)) return;
810 callback(null);
811 });
812 });
813 it('should add', function(callback) {
814 const execOptions = {
815 cwd: courseDevDir,
816 env: process.env,
817 };
818 exec(`git add -A`, execOptions, (err) => {
819 if (ERR(err, callback)) return;
820 callback(null);
821 });
822 });
823 it('should commit', function(callback) {
824 const execOptions = {
825 cwd: courseDevDir,
826 env: process.env,
827 };
828 exec(`git commit -m "commit from writeFile"`, execOptions, (err) => {
829 if (ERR(err, callback)) return;
830 callback(null);
831 });
832 });
833 it('should push', function(callback) {
834 const execOptions = {
835 cwd: courseDevDir,
836 env: process.env,
837 };
838 exec('git push', execOptions, (err) => {
839 if (ERR(err, callback)) return;
840 callback(null);
841 });
842 });
843 });
844}
845
846function pullInLive() {
847 describe('pull to live', function() {

Callers 1

doEditsFunction · 0.85

Calls 2

itFunction · 0.85
callbackFunction · 0.85

Tested by

no test coverage detected