Skip to content

Commit

Permalink
forgot to add these...
Browse files Browse the repository at this point in the history
  • Loading branch information
fergiemcdowall committed Nov 9, 2022
1 parent 71d4474 commit 83fbad0
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dist/search-index-3.3.0.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions dist/search-index-3.3.0.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
2 changes: 2 additions & 0 deletions dist/search-index-esm-3.3.0.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions dist/search-index-esm-3.3.0.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
52 changes: 52 additions & 0 deletions test/src/LAST_UPDATED-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const si = require('../../')
const test = require('tape')

const sandbox = 'test/sandbox/'
const indexName = sandbox + 'LAST_UPDATED'

let timestamp

test('create index', t => {
t.plan(1)
si({ name: indexName }).then(db => {
global[indexName] = db
t.ok(db, !undefined)
})
})

test('timestamp was created', t => {
t.plan(1)
global[indexName].INDEX.STORE.get(['~LAST_UPDATED']).then(lastUpdated => {
timestamp = lastUpdated
return t.pass('timestamp created')
})
})

test('can read LAST_UPDATED timestamp with API', t => {
t.plan(1)
global[indexName].LAST_UPDATED().then(res => t.equals(res, timestamp))
})

test('is valid timestamp', t => {
t.plan(1)
global[indexName].INDEX.STORE.get(['~LAST_UPDATED']).then(lastUpdated =>
t.ok(new Date(lastUpdated))
)
})

test('update index', t => {
t.plan(1)
global[indexName]
.PUT([
{
_id: 0,
body: 'test doc'
}
])
.then(res => t.ok(true))
})

test('LAST_UPDATED timestamp has increased', t => {
t.plan(1)
global[indexName].LAST_UPDATED().then(res => t.ok(res > timestamp))
})

0 comments on commit 83fbad0

Please sign in to comment.