Last active
August 29, 2015 14:15
-
-
Save dbousamra/0120212d1170a4e3d35c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("Event save", () => { | |
| it("Should be able to retrieve an event from the database, mutate the data, and save it", (done) => { | |
| return eventRepo.findOneById('54c305fd1431209617db8221').then((eventO: m.Option<domain.Event>) => { | |
| var event = eventO.get(); | |
| event.hash = 'foobar'; | |
| return eventRepo.save(event).then((savedEvent) => { | |
| return eventRepo.findOneById('54c305fd1431209617db8221').then((updatedEvent) => { | |
| updatedEvent.isDefined.should.be.true | |
| updatedEvent.foreach((ev) => ev.should.eql(event)) | |
| }); | |
| }); | |
| }) | |
| .done(done) | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("Event save", () => { | |
| it("Should be able to retrieve an event from the database, mutate the data, and save it", (done) => { | |
| return eventRepo.findOneById('54c305fd1431209617db8221').then((eventO: m.Option<domain.Event>) => { | |
| eventO.match({ | |
| Some: (event) => { | |
| event.hash = 'foobar'; | |
| eventRepo.save(event).then(() => { | |
| return eventRepo.findOneById('54c305fd1431209617db8221').then((updatedEventO) => { | |
| updatedEventO.match({ | |
| Some: (ev) => ev.should.eql(event)), | |
| None: () => // what do | |
| }) | |
| }); | |
| }); | |
| }, | |
| None: () => // what to do here? | |
| }) | |
| }) | |
| .done(done) | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment