Permalink
Browse files

Add a test

  • Loading branch information...
vaheqelyan
vaheqelyan committed Jan 11, 2019
1 parent 61399f1 commit 2e48038b00cc52703728f3bde0be88af334d45c5
Showing with 19 additions and 0 deletions.
  1. +19 −0 test/node/post.js
@@ -2,6 +2,25 @@
import test from "ava";
import { post } from "../../build/browser/index.umd.js";

test("Creating a resource in jsonplaceholder. (Content-Type)", async t => {
t.plan(2);

try {
const _post = {
title: "foo",
body: "bar",
userId: Math.random(),
};
const data = await post`https://jsonplaceholder.typicode.com/posts
Content-type: application/json
${JSON.stringify(_post)}`;
t.is(data.status, 201);
t.is(data.data.constructor, Object);
} catch (err) {
console.log(err);
}
});

test("Creating a resource in jsonplaceholder.", async t => {
t.plan(2);

0 comments on commit 2e48038

Please sign in to comment.