/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import * as chai from 'chai'
+import { expect } from 'chai'
import {
BooleanBothQuery,
VideoChannelsSearchQuery,
} from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/server-commands'
-const expect = chai.expect
-
describe('Test index search', function () {
const localVideoName = 'local video' + new Date().toISOString()
describe('Default search', async function () {
it('Should make a local videos search by default', async function () {
- this.timeout(10000)
-
await server.config.updateCustomSubConfig({
newConfig: {
search: {
expect(body.total).to.equal(1)
expect(body.data[0].name).to.equal('root_channel')
- expect(body.data[0].host).to.equal('localhost:' + server.port)
+ expect(body.data[0].host).to.equal(server.host)
})
it('Should make an index videos search by default', async function () {
const body = await command.searchChannels({ search: 'root' })
expect(body.total).to.be.greaterThan(2)
})
-
- it('Should make an index videos search if local search is disabled', async function () {
- await server.config.updateCustomSubConfig({
- newConfig: {
- search: {
- searchIndex: {
- enabled: true,
- isDefaultSearch: false,
- disableLocalSearch: true
- }
- }
- }
- })
-
- const body = await command.searchVideos({ search: 'local video' })
- expect(body.total).to.be.greaterThan(2)
- })
-
- it('Should make an index channels search if local search is disabled', async function () {
- const body = await command.searchChannels({ search: 'root' })
- expect(body.total).to.be.greaterThan(2)
- })
})
describe('Videos search', async function () {