Skip to content

Commit

Permalink
Merge pull request #12 from vitkarpov/fix-typos
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
ujenjt committed Nov 12, 2018
2 parents 9cb5bf8 + 2b3b32d commit 9ba8e8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const callRateLimiter = require('../')
const { rateLimit, objectRateLimit, } = callRateLimiter

describe('CallRateLimit module interface', () => {
it('rateLimit should works', async () => {
it('rateLimit should work', async () => {
const fn = jest.fn().mockImplementation(() => Promise.resolve(42))

const now = Date.now()
Expand All @@ -28,7 +28,7 @@ describe('CallRateLimit module interface', () => {
expect(Date.now() - now).toBeGreaterThan(1000)
})

it('objectRateLimit should works', async () => {
it('objectRateLimit should work', async () => {
const api = {
fn1: jest.fn().mockImplementation(() => Promise.resolve('first')),
fn2: jest.fn().mockImplementation(() => Promise.resolve('second')),
Expand Down
14 changes: 7 additions & 7 deletions test/sliding-window-timestamps.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const SlidingWindowTimestams = require('../sliding-window-timestamps')
const SlidingWindowTimestamps = require('../sliding-window-timestamps')
const MockNow = require('./mock-now')

describe('SlidingWindowTimestams', () => {
describe('SlidingWindowTimestamps', () => {
const mockNow = new MockNow(0)
const timestamps = new SlidingWindowTimestams(5, () => mockNow.now())
const timestamps = new SlidingWindowTimestamps(5, () => mockNow.now())

beforeEach(() => {
timestamps.clear()
Expand All @@ -15,7 +15,7 @@ describe('SlidingWindowTimestams', () => {
})

it('uses default nowFn if it has not passed', () => {
const t = new SlidingWindowTimestams(1)
const t = new SlidingWindowTimestamps(1)
expect(t.nowFn).toBe(Date.now)
})

Expand Down Expand Up @@ -46,18 +46,18 @@ describe('SlidingWindowTimestams', () => {
expect(timestamps.count()).toBe(4)
})

it('should displace timestamps out of window', () => {
it('should displace timestamps out of the window', () => {
timestamps.push(mockNow.now())
mockNow.advanceTime(6)

expect(timestamps.count()).toBe(0)
})

it('should return undefined if there is no oldest one in window', () => {
it('should return undefined if there is no oldest one in the window', () => {
expect(timestamps.oldestInWindow()).toBe(undefined)
})

it('should return undefined in case when oldest one out of window', () => {
it('should return undefined in case when oldest one out of the window', () => {
mockNow.advanceTime(1)
timestamps.push(mockNow.now())

Expand Down

0 comments on commit 9ba8e8e

Please sign in to comment.