mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 23:37:48 +01:00
test isUploaded()
This commit is contained in:
@@ -114,6 +114,8 @@ describe("photos", function () {
|
|||||||
});
|
});
|
||||||
expect(dbPhoto.hash).to.be.equal(dogHash);
|
expect(dbPhoto.hash).to.be.equal(dogHash);
|
||||||
|
|
||||||
|
expect(await dbPhoto.isUploaded()).to.be.equal(false);
|
||||||
|
|
||||||
await request(callback)
|
await request(callback)
|
||||||
.post(`/photos/upload/${photo.id}`)
|
.post(`/photos/upload/${photo.id}`)
|
||||||
.set({
|
.set({
|
||||||
@@ -123,6 +125,8 @@ describe("photos", function () {
|
|||||||
.attach("photo", dogPath)
|
.attach("photo", dogPath)
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
|
expect(await dbPhoto.isUploaded()).to.be.equal(true);
|
||||||
|
|
||||||
const showResp = await request(callback)
|
const showResp = await request(callback)
|
||||||
.get(`/photos/showByID/${photo.id}`)
|
.get(`/photos/showByID/${photo.id}`)
|
||||||
.set({
|
.set({
|
||||||
@@ -159,6 +163,7 @@ describe("photos", function () {
|
|||||||
user: seed.user1.id as any,
|
user: seed.user1.id as any,
|
||||||
});
|
});
|
||||||
expect(dbPhoto.hash).to.be.equal(dogHash);
|
expect(dbPhoto.hash).to.be.equal(dogHash);
|
||||||
|
expect(await dbPhoto.isUploaded()).to.be.equal(false);
|
||||||
|
|
||||||
await request(callback)
|
await request(callback)
|
||||||
.post(`/photos/upload/${photo.id}`)
|
.post(`/photos/upload/${photo.id}`)
|
||||||
@@ -168,6 +173,8 @@ describe("photos", function () {
|
|||||||
})
|
})
|
||||||
.attach("photo", dogPath)
|
.attach("photo", dogPath)
|
||||||
.expect(404);
|
.expect(404);
|
||||||
|
|
||||||
|
expect(await dbPhoto.isUploaded()).to.be.equal(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create, upload but not show a photo to another user", async function () {
|
it("should create, upload but not show a photo to another user", async function () {
|
||||||
@@ -194,6 +201,7 @@ describe("photos", function () {
|
|||||||
user: seed.user1.id as any,
|
user: seed.user1.id as any,
|
||||||
});
|
});
|
||||||
expect(dbPhoto.hash).to.be.equal(dogHash);
|
expect(dbPhoto.hash).to.be.equal(dogHash);
|
||||||
|
expect(await dbPhoto.isUploaded()).to.be.equal(false);
|
||||||
|
|
||||||
await request(callback)
|
await request(callback)
|
||||||
.post(`/photos/upload/${photo.id}`)
|
.post(`/photos/upload/${photo.id}`)
|
||||||
@@ -204,6 +212,8 @@ describe("photos", function () {
|
|||||||
.attach("photo", dogPath)
|
.attach("photo", dogPath)
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
|
expect(await dbPhoto.isUploaded()).to.be.equal(true);
|
||||||
|
|
||||||
await request(callback)
|
await request(callback)
|
||||||
.get(`/photos/showByID/${photo.id}`)
|
.get(`/photos/showByID/${photo.id}`)
|
||||||
.set({
|
.set({
|
||||||
|
|||||||
Reference in New Issue
Block a user