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

Function doEdits

tests/testFileEditor.js:630–754  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

628}
629
630function doEdits(data) {
631 describe(`edit ${data.path}`, function() {
632 //
633 // "live" is a clone of origin (this is what's on the production server)
634 // "dev" is a clone of origin (this is what's on someone's laptop)
635 // "origin" is the bare git repo
636 //
637 // in LIVE
638 // - writeAndCommitFileInLive does git commit
639 // - pullInLive does git pull
640 // in DEV
641 // - pullAndVerifyFileInDev does git pull
642 // - writeAndPushFileInDev does git push
643 //
644 // Remember that "origHash" has whatever was on disk at last GET.
645 //
646 // (live at last post, live, dev, origin)
647 //
648
649 editGet(data.url, false, false, data.contentsA, null);
650 // (A, A, A, A)
651
652 badPost('save_and_sync', data.contentsB, data.url);
653 // (A, A, A, A)
654
655 editPost('save_and_sync', data.contentsB, data.url, true, false, null);
656 // (B, B, A, B)
657
658 waitForJobSequence(locals, 'Success');
659 pullAndVerifyFileInDev(data.path, data.contentsB);
660 // (B, B, B, B)
661
662 editGet(data.url, false, false, data.contentsB, null);
663 // (B, B, B, B)
664
665 writeAndCommitFileInLive(data.path, data.contentsA);
666 // (B, A, B, B)
667
668 editGet(data.url, false, false, data.contentsA, null);
669 // (A, A, B, B)
670
671 writeAndCommitFileInLive(data.path, data.contentsB);
672 // (A, B, B, B)
673
674 editPost('save_and_sync', data.contentsC, data.url, true, true, data.contentsB);
675 // (A, B, B, B)
676
677 waitForJobSequence(locals, 'Error');
678 pullAndVerifyFileInDev(data.path, data.contentsB);
679 // (A, B, B, B)
680
681 editGet(data.url, false, false, data.contentsB, null);
682 // (B, B, B, B)
683
684 editPost('save_and_sync', data.contentsA, data.url, true, false, null);
685 // (A, A, B, A)
686
687 waitForJobSequence(locals, 'Success');

Callers 1

testFileEditor.jsFile · 0.85

Calls 8

editGetFunction · 0.85
badPostFunction · 0.85
editPostFunction · 0.85
pullAndVerifyFileInDevFunction · 0.85
writeAndCommitFileInLiveFunction · 0.85
writeAndPushFileInDevFunction · 0.85
pullInLiveFunction · 0.85
waitForJobSequenceFunction · 0.70

Tested by

no test coverage detected