1
- import { jest , describe , it , beforeEach } from "@jest/globals "
1
+ import { describe , it , beforeEach , mock } from "node:test "
2
2
import * as assert from "node:assert"
3
3
import { OAuth } from "flickr-sdk"
4
4
@@ -7,11 +7,13 @@ describe("OAuth", function () {
7
7
8
8
beforeEach ( function ( ) {
9
9
oauth = new OAuth ( "consumer key" , "consumer secret" )
10
- jest . spyOn ( oauth , "timestamp" ) . mockReturnValue ( "499166400" )
10
+ mock . method ( oauth , "timestamp" , ( ) => "499166400" )
11
11
12
- jest
13
- . spyOn ( oauth , "nonce" )
14
- . mockReturnValue ( "p2m2bnHdXVIsQH0FUv0oN9XrJU57ak7dSSpHU36mn4k=" )
12
+ mock . method (
13
+ oauth ,
14
+ "nonce" ,
15
+ ( ) => "p2m2bnHdXVIsQH0FUv0oN9XrJU57ak7dSSpHU36mn4k=" ,
16
+ )
15
17
} )
16
18
17
19
it ( 'requires "consumerKey" and "consumerSecret"' , function ( ) {
@@ -44,7 +46,7 @@ describe("OAuth", function () {
44
46
45
47
describe ( "#timestamp" , function ( ) {
46
48
beforeEach ( function ( ) {
47
- jest . restoreAllMocks ( )
49
+ mock . restoreAll ( )
48
50
} )
49
51
50
52
it ( "returns the current system time in seconds" , function ( ) {
@@ -54,7 +56,7 @@ describe("OAuth", function () {
54
56
55
57
describe ( "#nonce" , function ( ) {
56
58
beforeEach ( function ( ) {
57
- jest . restoreAllMocks ( )
59
+ mock . restoreAll ( )
58
60
} )
59
61
60
62
it ( "returns a string" , function ( ) {
0 commit comments