generated from mnpjs/package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
114 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const { Octopus } = require('./lib'); | ||
|
||
/** | ||
* Create a new octopus. | ||
* @param {Food} initialFood | ||
*/ | ||
function makeOceanOctopus(initialFood) { | ||
const octopus = new Octopus('ocean') | ||
octopus.eat(initialFood) | ||
return octopus | ||
} | ||
|
||
/** | ||
* @typedef {import('./lib').Food} Food | ||
*/ | ||
|
||
module.exports.makeOceanOctopus = makeOceanOctopus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* An ocean creature. | ||
*/ | ||
class Octopus { | ||
/** | ||
* @param {string} location | ||
*/ | ||
constructor(location) { | ||
this.location = location | ||
} | ||
/** | ||
* Eat some food. | ||
* @param {string} food What food to eat. | ||
*/ | ||
eat(food) { | ||
console.log(food) | ||
} | ||
} | ||
|
||
/** | ||
* @typedef {Object} Food | ||
* @prop {number} quantity | ||
* @prop {number} calories | ||
*/ | ||
|
||
module.exports.Octopus = Octopus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Octopus } from './lib' | ||
|
||
/** | ||
* Create a new octopus. | ||
* @param {Food} initialFood | ||
*/ | ||
export function makeOceanOctopus(initialFood) { | ||
const octopus = new Octopus('ocean') | ||
octopus.eat(initialFood) | ||
return octopus | ||
} | ||
|
||
/** | ||
* @typedef {import('./lib').Food} Food | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* An ocean creature. | ||
*/ | ||
export class Octopus { | ||
/** | ||
* @param {string} location | ||
*/ | ||
constructor(location) { | ||
this.location = location | ||
} | ||
/** | ||
* Eat some food. | ||
* @param {string} food What food to eat. | ||
*/ | ||
eat(food) { | ||
console.log(food) | ||
} | ||
} | ||
|
||
/** | ||
* @typedef {Object} Food | ||
* @prop {number} quantity | ||
* @prop {number} calories | ||
*/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,6 @@ | ||
import { equal, ok } from '@zoroaster/assert' | ||
import Context from '../context' | ||
import typescript from '../../src' | ||
import { makeOceanOctopus } from '../../src' | ||
|
||
/** @type {TestSuite} */ | ||
const T = { | ||
context: Context, | ||
'is a function'() { | ||
equal(typeof typescript, 'function') | ||
}, | ||
async 'calls package without error'() { | ||
await typescript() | ||
}, | ||
async 'gets a link to the fixture'({ fixture }) { | ||
const text = fixture`text.txt` | ||
const res = await typescript({ | ||
text, | ||
}) | ||
ok(res, text) | ||
}, | ||
} | ||
|
||
/** | ||
* @typedef {import('../context').TestSuite} TestSuite | ||
*/ | ||
|
||
export default T | ||
makeOceanOctopus({ | ||
calories: 100, | ||
quantity: 10, | ||
}) |