Skip to content

Commit

Permalink
fix: ping SpecRef in ordering-safe way (#1499)
Browse files Browse the repository at this point in the history
* fix: ping in ordering-safe way

* variable ordering is still important

* specRefOk

* use specrefok

* no need to access .ok
  • Loading branch information
saschanaz committed Feb 12, 2018
1 parent 718d400 commit 11ac382
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/spec/core/biblio-spec.js
Expand Up @@ -59,18 +59,17 @@ describe("W3C — Bibliographic References", () => {
`;

afterAll(flushIframes);
let isSpecRefAvailable = false;
const bibRefsURL = new URL("https://specref.herokuapp.com/bibrefs");

let doc;
let specRefOk;
beforeAll(async () => {
doc = await makeRSDoc({ config, body });
specRefOk = (await fetch(bibRefsURL, { method: "HEAD" })).ok;
});

it("pings biblio service to see if it's running", async () => {
const res = await fetch(bibRefsURL, { method: "HEAD" });
expect(res.ok).toBeTruthy();
isSpecRefAvailable = res.ok;
it("pings biblio service to see if it's running", () => {
expect(specRefOk).toBeTruthy();
});

it("includes a dns-prefetch to bibref server", () => {
Expand All @@ -85,7 +84,7 @@ describe("W3C — Bibliographic References", () => {
let ref = doc.querySelector("#bib-TestRef1 + dd");
expect(ref).toBeTruthy();
// This prevents Jasmine from taking down the whole test suite if SpecRef is down.
if (!isSpecRefAvailable) {
if (!specRefOk) {
throw new Error(
"SpecRef seems to be down. Can't proceed with this spec."
);
Expand Down

0 comments on commit 11ac382

Please sign in to comment.