-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from SCCapstone/divine-testing-final
Divine testing final
- Loading branch information
Showing
3 changed files
with
51 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Post} from '../../Post' | ||
import { alterPostScoreClean, doesPostExist, getScoreFromPostInDatabase, pushPostToDatabase, removePostFromDatabase } from '../../firebaseConfig' | ||
|
||
test('Create post and push to database.', async () => { | ||
var p1 = new Post("meso-229a6114ef7", "p1", null, "p1 -- test", 0, [], new Date().toString().substring(0, 24)); | ||
await pushPostToDatabase(p1) | ||
const result = await doesPostExist('p1') | ||
expect(result).toBe(true) | ||
}); | ||
|
||
test ('Increment post score by 1.', async () => { | ||
await alterPostScoreClean('p1', 1) | ||
const p1_score_1 = await getScoreFromPostInDatabase('p1') | ||
expect(p1_score_1).toBe(1) | ||
await alterPostScoreClean('p1', -1) | ||
}) | ||
|
||
test ('Decrement post score by 1.', async () => { | ||
await alterPostScoreClean('p1', -1) | ||
const p1_score_1 = await getScoreFromPostInDatabase('p1') | ||
expect(p1_score_1).toBe(-1) | ||
await alterPostScoreClean('p1', 1) // put back to zero | ||
}) | ||
|
||
|
||
|
This file contains 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