Skip to content

Commit

Permalink
Merge pull request #5108 from artsy/staging
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
damassi authored Feb 24, 2020
2 parents 70f0dda + 95225ce commit 98027d8
Show file tree
Hide file tree
Showing 20 changed files with 338 additions and 342 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ FROM node:12.14-alpine

WORKDIR /app

ENV CDN_PRODUCTION_URL=https://d1s2w0upia4e9w.cloudfront.net CDN_STAGING_URL=https://d1rmpw1xlv9rxa.cloudfront.net

# Install system dependencies
# Add deploy user
RUN apk --no-cache --quiet add \
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@artsy/gemup": "0.0.3",
"@artsy/palette": "7.1.0",
"@artsy/passport": "1.1.11",
"@artsy/reaction": "25.17.1",
"@artsy/reaction": "25.18.0",
"@artsy/stitch": "6.1.6",
"@babel/core": "7.6.0",
"@babel/node": "7.6.1",
Expand Down
87 changes: 63 additions & 24 deletions src/desktop/apps/article/__tests__/routes.jest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ import * as routes from "../routes"
import { extend } from "lodash"
import { GalleryInsightsRedirects } from "../gallery_insights_redirects"
const Article = require("desktop/models/article.coffee")
const Channel = require("desktop/models/channel.coffee")

jest.mock("desktop/lib/positronql", () => ({
positronql: jest.fn(),
}))

jest.mock("lib/metaphysics.coffee", () => jest.fn())

jest.mock("sharify", () => ({
data: {
ARTSY_EDITORIAL_CHANNEL: "123",
GALLERY_INSIGHTS_CHANNEL: "987",
APP_URL: "https://artsy.net",
EOY_2018_ARTISTS: "5bf30690d8b9430baaf6c6de",
PC_ARTSY_CHANNEL: "5759e508b5989e6f98f77999",
PC_AUCTION_CHANNEL: "5759e4d7b5989e6f98f77997",
},
}))

Expand All @@ -26,6 +29,7 @@ jest.mock("@artsy/stitch", () => ({

const positronql = require("desktop/lib/positronql").positronql as jest.Mock
const stitch = require("@artsy/stitch").stitch as jest.Mock
const metaphysics = require("lib/metaphysics.coffee") as jest.Mock

describe("Article Routes", () => {
let req
Expand Down Expand Up @@ -68,6 +72,7 @@ describe("Article Routes", () => {
afterEach(() => {
positronql.mockClear()
stitch.mockClear()
metaphysics.mockClear()
})

describe("#index", () => {
Expand Down Expand Up @@ -159,7 +164,9 @@ describe("Article Routes", () => {
positronql.mockReturnValue(Promise.resolve({ article }))

routes.index(req, res, next).then(() => {
expect(res.render.mock.calls[0][0]).toBe("article")
const { data, locals } = stitch.mock.calls[0][0]
expect(locals.assetPackage).toBe("article")
expect(data.article.title).toBe("New York's Next Art District")
done()
})
})
Expand Down Expand Up @@ -333,39 +340,71 @@ describe("Article Routes", () => {
})

describe("#classic", () => {
let channel
it("renders a classic article", done => {
routes.classic(req, res, next, fixtures.ClassicArticle).then(() => {
const { data } = stitch.mock.calls[0][0]
expect(data.article.title).toBe(
"New Study of Yale Grads Shows the Gender Pay Gap for Artists Is Not So Simple"
)
done()
})
})

beforeEach(() => {
channel = new Channel({ name: "Foo" })
article = extend(fixtures.ClassicArticle, {
slug: "foobar",
it("fetches partner for gallery promoted content", done => {
article = Object.assign({}, fixtures.ClassicArticlePromotedContent, {
channel_id: sd.PC_ARTSY_CHANNEL,
partner_ids: ["123"],
sale: null,
})
metaphysics.mockReturnValue(
Promise.resolve({ partner: fixtures.ClassicArticlePartner })
)

Article.prototype.fetchWithRelated.mockImplementation(options => {
options.success({ article: new Article(article), channel })
routes.classic(req, res, next, article).then(() => {
const { data } = stitch.mock.calls[0][0]
expect(data.article.partner.name).toBe("Contessa Gallery")
done()
})
})

it("renders a classic article", () => {
routes.classic(req, res, next)
expect(res.render.mock.calls[0][1].article.get("slug")).toBe("foobar")
expect(res.render.mock.calls[0][1].channel.get("name")).toBe("Foo")
it("fetches sale for auction promoted content", done => {
article = Object.assign({}, fixtures.ClassicArticlePromotedContent)
delete article.sale
metaphysics.mockReturnValue(
Promise.resolve({ sale: fixtures.ClassicArticleSale })
)

routes.classic(req, res, next, article).then(() => {
const { data } = stitch.mock.calls[0][0]
expect(data.article.sale.name).toBe("ICI: Benefit Auction 2019")
done()
})
})

it("renders a ghosted article (no channel)", () => {
Article.prototype.fetchWithRelated.mockImplementationOnce(options => {
options.success({ article: new Article(article) })
it("renders a ghosted article (no channel)", done => {
article = Object.assign({}, fixtures.ClassicArticle)
delete article.channel_id
delete article.author
delete article.partner_channel_id

routes.classic(req, res, next, article).then(() => {
const { data } = stitch.mock.calls[0][0]
expect(data.article.title).toBe(
"New Study of Yale Grads Shows the Gender Pay Gap for Artists Is Not So Simple"
)
done()
})
routes.classic(req, res, next)
expect(res.render.mock.calls[0][1].article.get("slug")).toBe("foobar")
})

it("sets the correct jsonld", () => {
routes.classic(req, res, next)
expect(res.locals.jsonLD).toMatch(
"Gender Pay Gap for Artists Is Not So Simple"
)
expect(res.locals.jsonLD).toMatch("Partner")
it("sets the correct jsonld", done => {
routes.classic(req, res, next, fixtures.ClassicArticle).then(() => {
const {
data: { jsonLD },
} = stitch.mock.calls[0][0]
expect(jsonLD).toMatch("Gender Pay Gap for Artists Is Not So Simple")
expect(jsonLD).toMatch("Partner")
done()
})
})
})

Expand Down
137 changes: 0 additions & 137 deletions src/desktop/apps/article/client/__tests__/classic.test.js

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 98027d8

Please sign in to comment.