Skip to content

Commit

Permalink
Release v1.4.1 (#322)
Browse files Browse the repository at this point in the history
Release v1.4.1
  • Loading branch information
lindskogen authored Aug 22, 2019
2 parents e98b31e + 2daffa9 commit d95e16c
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.3.1
version=1.4.1
3 changes: 3 additions & 0 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ http {
index index.html;
try_files $uri $uri/ /index.html;
}
location /gitinfo {
default_type text/plain;
}
location /api {
proxy_pass http://backend;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "0.1.0",
"version": "1.4.1",
"private": true,
"devDependencies": {
"apollo": "^2.17.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { groupSeatingRange, formatSeatingRange } from "./summarizeSeatingRange";
import {
formatSeatingRange,
groupSeatingRange
} from "../summarizeSeatingRange";

describe("summarizeSeatingRange", () => {
describe("groupSeatingRange", () => {
Expand All @@ -24,6 +27,26 @@ describe("summarizeSeatingRange", () => {
[8, 9]
]);
});
describe("real world examples", () => {
it("1, 2, 3", () => {
expect(groupSeatingRange([1, 2, 3])).toEqual([[1, 2, 3]]);
});

it("8, 9, 10, 11", () => {
expect(groupSeatingRange([8, 9, 10, 11])).toEqual([[8, 9, 10, 11]]);
});

it("19, 20, 21, 22", () => {
expect(groupSeatingRange([19, 20, 21, 22])).toEqual([[19, 20, 21, 22]]);
});
it("29, 30, 31", () => {
expect(groupSeatingRange([29, 30, 31])).toEqual([[29, 30, 31]]);
});
it("39, 40", () => {
expect(groupSeatingRange([39, 40])).toEqual([[39, 40]]);
});
});

it("should not fail on empty array as input", () => {
expect(groupSeatingRange([])).toEqual([]);
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/summarizeSeatingRange.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const groupSeatingRange = (nums: number[]): number[][] =>
nums.reduce<{ groups: number[][]; lastElement: number | undefined }>(
({ groups, lastElement }, curr) => {
if (curr !== (lastElement || 0) + 1) {
if (lastElement === undefined || curr !== lastElement + 1) {
groups.push([curr]);
} else {
groups[groups.length - 1].push(curr);
Expand Down
48 changes: 48 additions & 0 deletions frontend/src/use-cases/showing-tickets/__test__/SeatRange.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { cleanup, render } from "@testing-library/react";
import * as React from "react";
import { Ticket_ticketRange } from "../../../apollo/mutations/__generated__/Ticket";
import { SeatRange } from "../SeatRange";

const ticketRange: Ticket_ticketRange = {
rows: [1, 2, 3, 4, 5],
seatings: [
{
row: 1,
numbers: [1, 2, 3],
__typename: "SeatRange"
},
{
row: 2,
numbers: [8, 9, 10, 11],
__typename: "SeatRange"
},
{
row: 3,
numbers: [19, 20, 21, 22],
__typename: "SeatRange"
},
{
row: 4,
numbers: [29, 30, 31],
__typename: "SeatRange"
},
{
row: 5,
numbers: [39, 40],
__typename: "SeatRange"
}
],
__typename: "TicketRange"
};

afterEach(cleanup);

describe("<SeatRange />", () => {
it("works", () => {
const { queryByText, debug } = render(<SeatRange ticketRange={ticketRange} />);
const text = queryByText("29-31");
const text2 = queryByText("19-22");
expect(text).toBeDefined();
expect(text2).toBeDefined();
});
});

0 comments on commit d95e16c

Please sign in to comment.