Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

amal-Pull request #15

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
First Commit
Added new route named "careers"
amalraj1264 authored Sep 11, 2022
commit 1f7eaeb64a889fc102f5a9b871e7b81ffc14efdd
282 changes: 141 additions & 141 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,141 +1,141 @@
# PolyForm Shield License 1.0.0

<https://polyformproject.org/licenses/shield/1.0.0>

## Acceptance

In order to get any license under these terms, you must agree to them as both
strict obligations and conditions to all your licenses.

## Copyright License

The licensor grants you a copyright license for the software to do everything
you might do with the software that would otherwise infringe the licensor's
copyright in it for any permitted purpose. However, you may only distribute the
software according to [Distribution License](#distribution-license) and make
changes or new works based on the software according to
[Changes and New Works License](#changes-and-new-works-license).

## Distribution License

The licensor grants you an additional copyright license to distribute copies of
the software. Your license to distribute covers distributing the software with
changes and new works permitted by
[Changes and New Works License](#changes-and-new-works-license).

## Notices

You must ensure that anyone who gets a copy of any part of the software from you
also gets a copy of these terms or the URL for them above, as well as copies of
any plain-text lines beginning with `Required Notice:` that the licensor
provided with the software. For example:

> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
## Changes and New Works License

The licensor grants you an additional copyright license to make changes and new
works based on the software for any permitted purpose.

## Patent License

The licensor grants you a patent license for the software that covers patent
claims the licensor can license, or becomes able to license, that you would
infringe by using the software.

## Noncompete

Any purpose is a permitted purpose, except for providing any product that
competes with the software or any product the licensor or any of its affiliates
provides using the software.

## Competition

Goods and services compete even when they provide functionality through
different kinds of interfaces or for different technical platforms. Applications
can compete with services, libraries with plugins, frameworks with development
tools, and so on, even if they're written in different programming languages or
for different computer architectures. Goods and services compete even when
provided free of charge. If you market a product as a practical substitute for
the software or another product, it definitely competes.

## New Products

If you are using the software to provide a product that does not compete, but
the licensor or any of its affiliates brings your product into competition by
providing a new version of the software or another product using the software,
you may continue using versions of the software available under these terms
beforehand to provide your competing product, but not any later versions.

## Discontinued Products

You may begin using the software to compete with a product or service that the
licensor or any of its affiliates has stopped providing, unless the licensor
includes a plain-text line beginning with `Licensor Line of Business:` with the
software that mentions that line of business. For example:

> Licensor Line of Business: YoyodyneCMS Content Management System
> (http://example.com/cms)
## Sales of Business

If the licensor or any of its affiliates sells a line of business developing the
software or using the software to provide a product, the buyer can also enforce
[Noncompete](#noncompete) for that product.

## Fair Use

You may have "fair use" rights for the software under the law. These terms do
not limit them.

## No Other Rights

These terms do not allow you to sublicense or transfer any of your licenses to
anyone else, or prevent the licensor from granting licenses to anyone else.
These terms do not imply any other licenses.

## Patent Defense

If you make any written claim that the software infringes or contributes to
infringement of any patent, your patent license for the software granted under
these terms ends immediately. If your company makes such a claim, your patent
license ends immediately for work on behalf of your company.

## Violations

The first time you are notified in writing that you have violated any of these
terms, or done anything with the software not covered by your licenses, your
licenses can nonetheless continue if you come into full compliance with these
terms, and take practical steps to correct past violations, within 32 days of
receiving notice. Otherwise, all your licenses end immediately.

## No Liability

_**As far as the law allows, the software comes as is, without any warranty or
condition, and the licensor will not be liable to you for any damages arising
out of these terms or the use or nature of the software, under any kind of legal
claim.**_

## Definitions

The **licensor** is the individual or entity offering these terms, and the
**software** is the software the licensor makes available under these terms.

A **product** can be a good or service, or a combination of them.

**You** refers to the individual or entity agreeing to these terms.

**Your company** is any legal entity, sole proprietorship, or other kind of
organization that you work for, plus all its affiliates.

**Affiliates** means the other organizations than an organization has control
over, is under the control of, or is under common control with.

**Control** means ownership of substantially all the assets of an entity, or the
power to direct its management and policies by vote, contract, or otherwise.
Control can be direct or indirect.

**Your licenses** are all the licenses granted to you for the software under
these terms.

**Use** means anything you do with the software requiring one of your licenses.
# PolyForm Shield License 1.0.0

<https://polyformproject.org/licenses/shield/1.0.0>

## Acceptance

In order to get any license under these terms, you must agree to them as both
strict obligations and conditions to all your licenses.

## Copyright License

The licensor grants you a copyright license for the software to do everything
you might do with the software that would otherwise infringe the licensor's
copyright in it for any permitted purpose. However, you may only distribute the
software according to [Distribution License](#distribution-license) and make
changes or new works based on the software according to
[Changes and New Works License](#changes-and-new-works-license).

## Distribution License

The licensor grants you an additional copyright license to distribute copies of
the software. Your license to distribute covers distributing the software with
changes and new works permitted by
[Changes and New Works License](#changes-and-new-works-license).

## Notices

You must ensure that anyone who gets a copy of any part of the software from you
also gets a copy of these terms or the URL for them above, as well as copies of
any plain-text lines beginning with `Required Notice:` that the licensor
provided with the software. For example:

> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
## Changes and New Works License

The licensor grants you an additional copyright license to make changes and new
works based on the software for any permitted purpose.

## Patent License

The licensor grants you a patent license for the software that covers patent
claims the licensor can license, or becomes able to license, that you would
infringe by using the software.

## Noncompete

Any purpose is a permitted purpose, except for providing any product that
competes with the software or any product the licensor or any of its affiliates
provides using the software.

## Competition

Goods and services compete even when they provide functionality through
different kinds of interfaces or for different technical platforms. Applications
can compete with services, libraries with plugins, frameworks with development
tools, and so on, even if they're written in different programming languages or
for different computer architectures. Goods and services compete even when
provided free of charge. If you market a product as a practical substitute for
the software or another product, it definitely competes.

## New Products

If you are using the software to provide a product that does not compete, but
the licensor or any of its affiliates brings your product into competition by
providing a new version of the software or another product using the software,
you may continue using versions of the software available under these terms
beforehand to provide your competing product, but not any later versions.

## Discontinued Products

You may begin using the software to compete with a product or service that the
licensor or any of its affiliates has stopped providing, unless the licensor
includes a plain-text line beginning with `Licensor Line of Business:` with the
software that mentions that line of business. For example:

> Licensor Line of Business: YoyodyneCMS Content Management System
> (http://example.com/cms)
## Sales of Business

If the licensor or any of its affiliates sells a line of business developing the
software or using the software to provide a product, the buyer can also enforce
[Noncompete](#noncompete) for that product.

## Fair Use

You may have "fair use" rights for the software under the law. These terms do
not limit them.

## No Other Rights

These terms do not allow you to sublicense or transfer any of your licenses to
anyone else, or prevent the licensor from granting licenses to anyone else.
These terms do not imply any other licenses.

## Patent Defense

If you make any written claim that the software infringes or contributes to
infringement of any patent, your patent license for the software granted under
these terms ends immediately. If your company makes such a claim, your patent
license ends immediately for work on behalf of your company.

## Violations

The first time you are notified in writing that you have violated any of these
terms, or done anything with the software not covered by your licenses, your
licenses can nonetheless continue if you come into full compliance with these
terms, and take practical steps to correct past violations, within 32 days of
receiving notice. Otherwise, all your licenses end immediately.

## No Liability

_**As far as the law allows, the software comes as is, without any warranty or
condition, and the licensor will not be liable to you for any damages arising
out of these terms or the use or nature of the software, under any kind of legal
claim.**_

## Definitions

The **licensor** is the individual or entity offering these terms, and the
**software** is the software the licensor makes available under these terms.

A **product** can be a good or service, or a combination of them.

**You** refers to the individual or entity agreeing to these terms.

**Your company** is any legal entity, sole proprietorship, or other kind of
organization that you work for, plus all its affiliates.

**Affiliates** means the other organizations than an organization has control
over, is under the control of, or is under common control with.

**Control** means ownership of substantially all the assets of an entity, or the
power to direct its management and policies by vote, contract, or otherwise.
Control can be direct or indirect.

**Your licenses** are all the licenses granted to you for the software under
these terms.

**Use** means anything you do with the software requiring one of your licenses.
124 changes: 62 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
# AC Skill Test ([Web Engineer](https://activeconnector.notion.site/Active-Connector-Web-Engineer-002bfe6bbd764d5e9790b51651497952))

## Problem

Make changes on the project to pass CI on GitHub Actions, without modifying or
removing any existing lines in the original code.

> **Warning**\
> You may not refer any other forks or pull-requests of this repository, or ask
> someone for help.
> **Note**\
> Expected time required: 30-180 min\
> Expected amount of code added: approx. 30 lines
## Submission

Send a pull-request to this repository.

Feel free to submit an uncompleted work and ask questions there.

> **Warning**\
> Plagiarism is strictly prohibited and carefully checked.
> **Note**\
> We may request you to make your forked repository private after screening.
## Hints

### Tech stack

Application:

- Language: [TypeScript](https://www.typescriptlang.org/)
- Runtime: [Deno](https://deno.land/)
- Framework: [Fresh](https://fresh.deno.dev/)

DevOps:

- Version Management: [Git](https://git-scm.com/)
- CI/CD: [GitHub Actions](https://github.co.jp/features/actions)
- E2E Test: [Sinco](https://drash.land/sinco/)

This does not necessarily reflect those in our real applications.

**You are not expected to be experienced with all of these**, but expected to be
able to learn them quickly by yourself if needed.

### Run the app locally

```sh
$ deno task dev
```

See deno.json for other tasks.

## License

This repository is licensed under the [PolyForm-Shield](LICENSE.md) License.

You may not distribute copies of the repository for the purpose of helping
plagiarism, which is regarded as competition with the licenser.
# AC Skill Test ([Web Engineer](https://activeconnector.notion.site/Active-Connector-Web-Engineer-002bfe6bbd764d5e9790b51651497952))

## Problem

Make changes on the project to pass CI on GitHub Actions, without modifying or
removing any existing lines in the original code.

> **Warning**\
> You may not refer any other forks or pull-requests of this repository, or ask
> someone for help.
> **Note**\
> Expected time required: 30-180 min\
> Expected amount of code added: approx. 30 lines
## Submission

Send a pull-request to this repository.

Feel free to submit an uncompleted work and ask questions there.

> **Warning**\
> Plagiarism is strictly prohibited and carefully checked.
> **Note**\
> We may request you to make your forked repository private after screening.
## Hints

### Tech stack

Application:

- Language: [TypeScript](https://www.typescriptlang.org/)
- Runtime: [Deno](https://deno.land/)
- Framework: [Fresh](https://fresh.deno.dev/)

DevOps:

- Version Management: [Git](https://git-scm.com/)
- CI/CD: [GitHub Actions](https://github.co.jp/features/actions)
- E2E Test: [Sinco](https://drash.land/sinco/)

This does not necessarily reflect those in our real applications.

**You are not expected to be experienced with all of these**, but expected to be
able to learn them quickly by yourself if needed.

### Run the app locally

```sh
$ deno task dev
```

See deno.json for other tasks.

## License

This repository is licensed under the [PolyForm-Shield](LICENSE.md) License.

You may not distribute copies of the repository for the purpose of helping
plagiarism, which is regarded as competition with the licenser.
22 changes: 11 additions & 11 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"compilerOptions": {
"lib": ["deno.ns", "dom"]
},
"tasks": {
"dev": "deno run -A --watch=static/,routes/ dev.ts",
"start": "deno run --allow-run start.ts",
"test": "deno test --allow-net --allow-run --allow-env"
},
"importMap": "./import_map.json"
}
{
"compilerOptions": {
"lib": ["deno.ns", "dom"]
},
"tasks": {
"dev": "deno run -A --watch=static/,routes/ dev.ts",
"start": "deno run --allow-run start.ts",
"test": "deno test --allow-net --allow-run --allow-env"
},
"importMap": "./import_map.json"
}
10 changes: 5 additions & 5 deletions dev.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env -S deno run -A --watch=static/,routes/

import dev from "$fresh/dev.ts";

await dev(import.meta.url, "./main.ts");
#!/usr/bin/env -S deno run -A --watch=static/,routes/

import dev from "$fresh/dev.ts";

await dev(import.meta.url, "./main.ts");
11 changes: 8 additions & 3 deletions fresh.gen.ts
Original file line number Diff line number Diff line change
@@ -2,13 +2,18 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.

import * as $0 from "./routes/index.tsx";
import * as $0 from "./routes/careers.tsx";
import * as $1 from "./routes/index.tsx";
import * as $$0 from "./islands/careers.tsx";

const manifest = {
routes: {
"./routes/index.tsx": $0,
"./routes/careers.tsx": $0,
"./routes/index.tsx": $1,
},
islands: {
"./islands/careers.tsx": $$0,
},
islands: {},
baseUrl: import.meta.url,
};

20 changes: 10 additions & 10 deletions import_map.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"imports": {
"testing/": "https://deno.land/std@0.150.0/testing/",
"$fresh/": "https://deno.land/x/fresh@1.0.2/",
"preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact",
"sinco/": "https://deno.land/x/sinco@v4.1.0/"
}
}
{
"imports": {
"testing/": "https://deno.land/std@0.150.0/testing/",
"$fresh/": "https://deno.land/x/fresh@1.0.2/",
"preact": "https://esm.sh/preact@10.10.0",
"preact/": "https://esm.sh/preact@10.10.0/",
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact",
"sinco/": "https://deno.land/x/sinco@v4.1.0/"
}
}
18 changes: 9 additions & 9 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference no-default-lib="true" />
/// <reference lib="dom" />
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.unstable" />

import { start } from "$fresh/server.ts";
import manifest from "./fresh.gen.ts";
await start(manifest);
/// <reference no-default-lib="true" />
/// <reference lib="dom" />
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.unstable" />

import { start } from "$fresh/server.ts";
import manifest from "./fresh.gen.ts";
await start(manifest);
12 changes: 6 additions & 6 deletions start.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const proc = Deno.run({
cmd: ["deno", "task", "dev"],
});

proc.close();
Deno.exit(0);
const proc = Deno.run({
cmd: ["deno", "task", "dev"],
});

proc.close();
Deno.exit(0);
172 changes: 86 additions & 86 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
import { buildFor } from "sinco/mod.ts";
import { assertEquals } from "testing/asserts.ts";

const CHROME_BIN = Deno.env.get("CHROME_BIN");

Deno.test("E2E test", async (t) => {
/* Start Sinco */
const { browser, page } = await buildFor("chrome", {
binaryPath: CHROME_BIN,
});

const index = "http://localhost:8000/";

/* Beginning of tests */

await t.step("click the logo", async () => {
await page.location(index);

const image = await page.querySelector("img");
await image.click({ waitFor: "navigation" });

assertEquals(await page.location(), "https://www.active-connector.com/");
});

await page.location(index);

await t.step("input is empty", async () => {
const input = await page.querySelector("input");
assertEquals(await input.value(), "");
});

await t.step("error is not shown", async () => {
const error = await page.evaluate(() =>
document.querySelector("p")?.innerText
);
assertEquals(error, undefined);
});

await t.step("show error for an empty input", async () => {
const button = await page.querySelector("button");
await button.click({ waitFor: "navigation" });

const error = await page.evaluate(() =>
document.querySelector("p")?.innerText
);
assertEquals(error, "error: empty input");
});

await t.step("input a random string and click the button", async () => {
const input = await page.querySelector("input");

const name = crypto.randomUUID().slice(0, 7);
await input.value(name);

const button = await page.querySelector("button");
await button.click({ waitFor: "navigation" });

assertEquals(await page.location(), `${index}jobs/${name}`);

const body = await page.evaluate(() => {
return document.querySelector("div")?.innerText;
});
assertEquals(body, `Job "${name}" is not available`);
});

await page.location(index);

await t.step("input 'engineer' and click the button", async () => {
const input = await page.querySelector("input");
await input.value("engineer");

const button = await page.querySelector("button");
await button.click({ waitFor: "navigation" });

assertEquals(await page.location(), `${index}jobs/engineer`);

const body = await page.evaluate(() => {
return document.querySelector("div")?.innerText;
});
assertEquals(body, `Job "engineer" is open for you!`);
});

/* End of tests */

await browser.close();
});
import { buildFor } from "sinco/mod.ts";
import { assertEquals } from "testing/asserts.ts";

const CHROME_BIN = Deno.env.get("CHROME_BIN");

Deno.test("E2E test", async (t) => {
/* Start Sinco */
const { browser, page } = await buildFor("chrome", {
binaryPath: CHROME_BIN,
});

const index = "http://localhost:8000/";

/* Beginning of tests */

await t.step("click the logo", async () => {
await page.location(index);

const image = await page.querySelector("img");
await image.click({ waitFor: "navigation" });

assertEquals(await page.location(), "https://www.active-connector.com/");
});

await page.location(index);

await t.step("input is empty", async () => {
const input = await page.querySelector("input");
assertEquals(await input.value(), "");
});

await t.step("error is not shown", async () => {
const error = await page.evaluate(() =>
document.querySelector("p")?.innerText
);
assertEquals(error, undefined);
});

await t.step("show error for an empty input", async () => {
const button = await page.querySelector("button");
await button.click({ waitFor: "navigation" });

const error = await page.evaluate(() =>
document.querySelector("p")?.innerText
);
assertEquals(error, "error: empty input");
});

await t.step("input a random string and click the button", async () => {
const input = await page.querySelector("input");

const name = crypto.randomUUID().slice(0, 7);
await input.value(name);

const button = await page.querySelector("button");
await button.click({ waitFor: "navigation" });

assertEquals(await page.location(), `${index}jobs/${name}`);

const body = await page.evaluate(() => {
return document.querySelector("div")?.innerText;
});
assertEquals(body, `Job "${name}" is not available`);
});

await page.location(index);

await t.step("input 'engineer' and click the button", async () => {
const input = await page.querySelector("input");
await input.value("engineer");

const button = await page.querySelector("button");
await button.click({ waitFor: "navigation" });

assertEquals(await page.location(), `${index}jobs/engineer`);

const body = await page.evaluate(() => {
return document.querySelector("div")?.innerText;
});
assertEquals(body, `Job "engineer" is open for you!`);
});

/* End of tests */

await browser.close();
});