diff --git a/.travis.yml b/.travis.yml index 7789109..e2d26a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: node_js node_js: - - "8" - "10" - "12" diff --git a/index.js b/index.js index ba7a84a..806fc18 100644 --- a/index.js +++ b/index.js @@ -6,4 +6,6 @@ function rdfFetch (url, { factory = defaultFactory, formats = defaultFormats, .. return rdfFetchLite(url, { factory, formats, ...options }) } +rdfFetch.Headers = rdfFetchLite.Headers + module.exports = rdfFetch diff --git a/package.json b/package.json index 344900f..2bc33da 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Wrapper for fetch to simplify sending and receiving RDF data", "main": "index.js", "scripts": { - "test": "standard && jest" + "test": "standard && mocha" }, "repository": { "type": "git", @@ -23,12 +23,12 @@ "homepage": "https://github.com/rdfjs-base/fetch", "dependencies": { "@rdfjs/dataset": "^1.0.1", - "@rdfjs/fetch-lite": "^2.0.1", + "@rdfjs/fetch-lite": "^2.1.0", "@rdfjs/formats-common": "^2.0.1" }, "devDependencies": { "@rdfjs/sink-map": "^1.0.1", - "jest": "^24.9.0", + "mocha": "^7.1.1", "nock": "^11.6.0", "standard": "^14.3.1" } diff --git a/test/Headers.test.js b/test/Headers.test.js new file mode 100644 index 0000000..595e7d5 --- /dev/null +++ b/test/Headers.test.js @@ -0,0 +1,20 @@ +const { strictEqual } = require('assert') +const { describe, it } = require('mocha') +const { Headers } = require('..') + +describe('Headers', () => { + it('should be a constructor', () => { + strictEqual(typeof Headers, 'function') + }) + + it('should implement the Headers interface', () => { + const headers = new Headers() + + strictEqual(typeof headers.append, 'function') + strictEqual(typeof headers.delete, 'function') + strictEqual(typeof headers.entries, 'function') + strictEqual(typeof headers.get, 'function') + strictEqual(typeof headers.has, 'function') + strictEqual(typeof headers.set, 'function') + }) +}) diff --git a/test/test.js b/test/test.js index ba37b0d..7c5205d 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ -/* global describe, expect, it */ - +const { strictEqual } = require('assert') +const { describe, it } = require('mocha') const nock = require('nock') const rdf = require('@rdfjs/dataset') const rdfFetch = require('..') @@ -7,14 +7,14 @@ const SinkMap = require('@rdfjs/sink-map') describe('@rdfjs/fetch', () => { it('should be a function', () => { - expect(typeof rdfFetch).toBe('function') + strictEqual(typeof rdfFetch, 'function') }) it('should return a Promise', () => { const result = rdfFetch('http://example.org/') - expect(typeof result).toBe('object') - expect(typeof result.then).toBe('function') + strictEqual(typeof result, 'object') + strictEqual(typeof result.then, 'function') }) it('should use formats common as default formats', async () => { @@ -30,14 +30,18 @@ describe('@rdfjs/fetch', () => { await rdfFetch('http://example.org/formats-common') - expect([ + const mediaTypes = [ 'application/ld+json', 'application/trig', 'application/n-quads', 'application/n-triples', 'text/n3', 'text/turtle' - ].every(mediaType => accept.includes(mediaType))).toBe(true) + ] + + mediaTypes.forEach(mediaType => { + strictEqual(accept.includes(mediaType), true) + }) }) it('should support custom formats', async () => { @@ -62,7 +66,7 @@ describe('@rdfjs/fetch', () => { formats: customFormats }) - expect(accept).toBe('application/ld+json, text/turtle') + strictEqual(accept, 'application/ld+json, text/turtle') }) it('should use @rdfjs/dataset as default factory', async () => { @@ -73,7 +77,7 @@ describe('@rdfjs/fetch', () => { const res = await rdfFetch('http://example.org/factory-default') const dataset = await res.dataset() - expect(dataset instanceof rdf.dataset().constructor).toBe(true) + strictEqual(dataset instanceof rdf.dataset().constructor, true) }) it('should support custom factory', async () => { @@ -93,6 +97,6 @@ describe('@rdfjs/fetch', () => { }) const dataset = await res.dataset() - expect(dataset instanceof CustomDataset).toBe(true) + strictEqual(dataset instanceof CustomDataset, true) }) })