Skip to content

Commit

Permalink
Update to Deno 1.2.0 (sholladay#47)
Browse files Browse the repository at this point in the history
* update deps

update delCookie to deleteCookie

* update supported version in readme

upgrade assert version

alias assertStrictEqual as assertStrictEq

* remove type assertions

* update .travis.yml

* Update imports

Co-authored-by: Seth Holladay <me@seth-holladay.com>
  • Loading branch information
afaur and sholladay committed Jul 16, 2020
1 parent 015a929 commit 94ad155
Show file tree
Hide file tree
Showing 14 changed files with 232 additions and 242 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,7 +1,7 @@
language: python

install:
- curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.1.1
- curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.2.0
- export PATH="$HOME/.deno/bin:$PATH"

script:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -6,7 +6,7 @@ Pogo is an easy-to-use, safe, and expressive framework for writing web servers a

[Documentation](./docs)

*Supports Deno v1.0.0 and higher.*
*Supports Deno v1.2.0 and higher.*

## Contents

Expand Down
8 changes: 4 additions & 4 deletions dependencies.ts
Expand Up @@ -2,11 +2,11 @@
import React from 'https://jspm.dev/react@16.13.1';
// @deno-types="https://deno.land/x/types/react-dom/v16.13.1/server.d.ts"
import ReactDOMServer from 'https://jspm.dev/react-dom@16.13.1/server';
import * as cookie from 'https://deno.land/std@v0.56.0/http/cookie.ts';
import * as http from 'https://deno.land/std@v0.56.0/http/server.ts';
import { Status as status, STATUS_TEXT as statusText } from 'https://deno.land/std@v0.56.0/http/http_status.ts';
import * as cookie from 'https://deno.land/std@v0.61.0/http/cookie.ts';
import * as http from 'https://deno.land/std@v0.61.0/http/server.ts';
import { Status as status, STATUS_TEXT as statusText } from 'https://deno.land/std@v0.61.0/http/http_status.ts';
import * as mime from 'https://cdn.pika.dev/mime-types@2.1.27';
import * as path from 'https://deno.land/std@v0.56.0/path/mod.ts';
import * as path from 'https://deno.land/std@v0.61.0/path/mod.ts';

export {
React,
Expand Down
12 changes: 1 addition & 11 deletions dev-dependencies.ts
@@ -1,11 +1 @@
import {
assert,
assertEquals,
assertStrictEq
} from 'https://deno.land/std@v0.56.0/testing/asserts.ts';

export {
assert,
assertEquals,
assertStrictEq
};
export * from 'https://deno.land/std@v0.61.0/testing/asserts.ts';
2 changes: 1 addition & 1 deletion example/react-on-server/dev-dependencies.ts
@@ -1 +1 @@
export * from 'https://deno.land/std@v0.60.0/testing/asserts.ts';
export * from 'https://deno.land/std@v0.61.0/testing/asserts.ts';
2 changes: 1 addition & 1 deletion example/simple-server/dev-dependencies.ts
@@ -1,4 +1,4 @@
import { assertEquals, assertStrictEq } from 'https://deno.land/std@v0.56.0/testing/asserts.ts';
import { assertEquals, assertStrictEq } from 'https://deno.land/std@v0.61.0/testing/asserts.ts';

export {
assertEquals,
Expand Down
8 changes: 4 additions & 4 deletions example/simple-server/test.js
@@ -1,4 +1,4 @@
import { assertStrictEq } from './dev-dependencies.ts';
import { assertStrictEquals } from './dev-dependencies.ts';
import server from './main.ts';

const { test } = Deno;
Expand All @@ -8,7 +8,7 @@ test('GET /', async () => {
method : 'GET',
url : '/'
});
assertStrictEq(response.status, 200);
assertStrictEq(response.headers.get('content-type'), 'text/html; charset=utf-8');
assertStrictEq(response.body, 'Hello, world!');
assertStrictEquals(response.status, 200);
assertStrictEquals(response.headers.get('content-type'), 'text/html; charset=utf-8');
assertStrictEquals(response.body, 'Hello, world!');
});
2 changes: 1 addition & 1 deletion lib/request.ts
Expand Up @@ -29,7 +29,7 @@ export default class Request {
this.referrer = this.headers.get('referer') || '';
this.response = new Response();
this.server = options.server;
this.state = cookie.getCookies(this as any);
this.state = cookie.getCookies(this);
this.url = new URL(this.raw.url, 'http://' + this.headers.get('host'));
}
get body() {
Expand Down
4 changes: 2 additions & 2 deletions lib/response.ts
Expand Up @@ -82,7 +82,7 @@ export default class Response {
state(name: cookie.Cookie): this;
state(name: string, value: string | CookieOptions): this;
state(name: string | cookie.Cookie, value?: string | CookieOptions) {
cookie.setCookie(this as object, {
cookie.setCookie(this, {
httpOnly : true,
sameSite : 'Strict',
secure : true,
Expand All @@ -95,7 +95,7 @@ export default class Response {
return this.header('Content-Type', mediaType);
}
unstate(name: string) {
cookie.delCookie(this as object, name);
cookie.deleteCookie(this, name);
return this;
}
}
30 changes: 15 additions & 15 deletions test/bang.js
@@ -1,7 +1,7 @@
import {
assert,
assertEquals,
assertStrictEq
assertStrictEquals
} from '../dev-dependencies.ts';
import Response from '../lib/response.ts';
import * as bang from '../lib/bang.ts';
Expand All @@ -12,9 +12,9 @@ test('new Bang() is a 500 error by default', () => {
const error = new bang.Bang();
assert(error instanceof Error);
assert(error instanceof bang.Bang);
assertStrictEq(error.message, 'Internal Server Error');
assertStrictEquals(error.message, 'Internal Server Error');
assert(error.response instanceof Response);
assertStrictEq(error.response.status, 500);
assertStrictEquals(error.response.status, 500);
assertEquals(error.response.body, {
error : 'Internal Server Error',
message : 'Internal Server Error',
Expand All @@ -25,8 +25,8 @@ test('new Bang() is a 500 error by default', () => {
test('new Bang() with custom message', () => {
const error = new bang.Bang('some problem');
assert(error instanceof Error);
assertStrictEq(error.message, 'some problem');
assertStrictEq(error.response.status, 500);
assertStrictEquals(error.message, 'some problem');
assertStrictEquals(error.response.status, 500);
assertEquals(error.response.body, {
error : 'Internal Server Error',
message : 'Internal Server Error',
Expand All @@ -37,8 +37,8 @@ test('new Bang() with custom message', () => {
test('new Bang() with custom message and explicit 500 status', () => {
const error = new bang.Bang('some problem', { status : 500 });
assert(error instanceof Error);
assertStrictEq(error.message, 'some problem');
assertStrictEq(error.response.status, 500);
assertStrictEquals(error.message, 'some problem');
assertStrictEquals(error.response.status, 500);
assertEquals(error.response.body, {
error : 'Internal Server Error',
message : 'Internal Server Error',
Expand All @@ -49,8 +49,8 @@ test('new Bang() with custom message and explicit 500 status', () => {
test('new Bang() with custom message and 501 status', () => {
const error = new bang.Bang('some problem', { status : 501 });
assert(error instanceof Error);
assertStrictEq(error.message, 'some problem');
assertStrictEq(error.response.status, 501);
assertStrictEquals(error.message, 'some problem');
assertStrictEquals(error.response.status, 501);
assertEquals(error.response.body, {
error : 'Not Implemented',
message : 'some problem',
Expand All @@ -61,8 +61,8 @@ test('new Bang() with custom message and 501 status', () => {
test('new Bang() with error', () => {
const error = new bang.Bang(new Error('some problem'));
assert(error instanceof Error);
assertStrictEq(error.message, 'some problem');
assertStrictEq(error.response.status, 500);
assertStrictEquals(error.message, 'some problem');
assertStrictEquals(error.response.status, 500);
assertEquals(error.response.body, {
error : 'Internal Server Error',
message : 'Internal Server Error',
Expand All @@ -73,8 +73,8 @@ test('new Bang() with error', () => {
test('new Bang() with error and 501 status', () => {
const error = new bang.Bang(new Error('some problem'), { status : 501 });
assert(error instanceof Error);
assertStrictEq(error.message, 'some problem');
assertStrictEq(error.response.status, 501);
assertStrictEquals(error.message, 'some problem');
assertStrictEquals(error.response.status, 501);
assertEquals(error.response.body, {
error : 'Not Implemented',
message : 'some problem',
Expand All @@ -84,11 +84,11 @@ test('new Bang() with error and 501 status', () => {

test('Bang.wrap() returns Bang instance as-is', () => {
const error = new bang.Bang();
assertStrictEq(bang.Bang.wrap(error), error);
assertStrictEquals(bang.Bang.wrap(error), error);
});

test('Bang.wrap() constructs new Bang from string', () => {
const error = bang.Bang.wrap('hello');
assertEquals(error, new bang.Bang('hello'));
assertStrictEq(error.constructor, bang.Bang);
assertStrictEquals(error.constructor, bang.Bang);
});

0 comments on commit 94ad155

Please sign in to comment.